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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -