Page 1 of 1

multiple select statements on a page

Posted: Wed Aug 12, 2009 4:35 pm
by ChadS
This might be a silly question, but I am trying to get 2 select statements to run on the same web page. The first one runs just fine, but when I try to use mysqli_query and fetch_array on the second one, nothing happens. Is there a step I am missing or can you not run multiple select statements on a single page?

Re: multiple select statements on a page

Posted: Wed Aug 12, 2009 5:27 pm
by requinix
Depends. What's your code?

Re: multiple select statements on a page

Posted: Thu Aug 13, 2009 9:42 am
by ChadS
Here is the code I am using. I removed the HTML stuff.

Code: Select all

<?php 
$id = $_POST['id'];
                    
$DBConnect = @mysqli_connect("localhost", "root", "anthonyno") or die("No Connection");
@mysqli_select_db($DBConnect, "realty") or die("Database Not Found");
 
$SQLstring = "SELECT * FROM general WHERE id = ". $id;
$QueryResult = @mysqli_query($DBConnect, $SQLstring);
 
 
$row = mysqli_fetch_array($QueryResult);
 
 
mysqli_free_result($QueryResult);
$SQLpicture = "SELECT filename FROM picture WHERE roomID = ".$id;
$pictureResult = @mysql_query($SQLpicture);
while ($pictureRow = mysqli_fetch_array($pictureResult))
    {
        echo "<img src='".$pictureRow['filename']."' alt='' width='149' height='122'/>";
        echo $pictureRow['filename']."<br>";
    }
 
 ?>
 
 
$pictureRow is empty. I tried echoing varies things that should be in it and there is nothing there.

Re: multiple select statements on a page

Posted: Thu Aug 13, 2009 11:07 am
by neuroxik
Never tried mysqli (only mysql), but try these just in case:

Line 16:

Code: Select all

$pictureResult = @mysqli_query($DBConnect, $SQLpicture);