[thelist] PHP: Array?
Lauri Väin
optima at hot.ee
Sat Oct 7 09:37:26 CDT 2000
Hello everybody,
It's me, again!
I have ca 15 tables in my mySQL db. Now, what I need to do is insert data and
pull it out from there later.
Right now, I would do it like this:
<?php
$db = mysql_connect("localhost", "root", "pass");
mysql_select_db("cvdb",$db);
// Kindla isiku C(urriculum)V(itae)
if ($id) {
$result = mysql_query("SELECT * FROM ie_cv_main WHERE id=$id",$db);
$myrow = mysql_fetch_array($result);
printf("Nimi: %s %s\n<br>", $myrow["first"], $myrow["last"]);
printf("E-mail: %s\n<br>", $myrow["email"]);
$result2=mysql_query("SELECT * FROM ie_cv_edu WHERE id=$id",$db);
$myrow2 = mysql_fetch_array($result);
printf("More data: %s %s\n<br>", $myrow["first"], $myrow["last"]);
printf("E-mail: %s\n<br>", $myrow["email"]);
}
and so on. Now, how can I make it simpler? Would array do it somehow(and I have
no knowledge about using it other than in the example above) ? Example code
would be highly appreciated. Feel free to send me something you've done yourself
(the e-mail is: optima at hot.ee)
Note: Some of the columns in different tables have the same name.
Thanks!
Yours,
Lauri
More information about the thelist
mailing list