MySQL / PHP: cannot perform two separate queries on same database? -
i have 1 database 2 tables: "music" , "agenda".
but reason once have queried 1 table, cannot perform similar query on other table. or in case, variables empty.
i'd think keep connection open , perform second query after first "while". so:
<?php mysql_connect('localhost', 'root', 'root'); mysql_select_db('erikverwey'); $result = mysql_query("select * agenda order date desc limit 0, 2") or die(mysql_error()); while($row = mysql_fetch_array($result)) { $count++; $date[$count] = $row['date']; $time[$count] = $row['time']; $place[$count] = $row['place']; $venue[$count] = $row['venue']; $who[$count] = $row['who']; $concert[$count] = $row['concert']; $urlvenue[$count] = $row['urlvenue']; } $result2 = mysql_query("select * music order id limit 0, 5") or die(mysql_error()); while($row = mysql_fetch_array($result2)) { $count++; $song[$count] = $row['song']; $artist[$count] = $row['artist']; $duration[$count] = $row['duration']; $url[$count] = $row['url']; } mysql_close(); ?>
but no. in case, variables table "music" remain empty.
i've been looking answer, no luck. i'm still new mysql, though, apologies beforehand if standard stuff. thanks!
i found glitch. because counter "$count" used second time, started left off , couldn't find data.
use different counter, in variables (!), , good.
Comments
Post a Comment