multiple select statements on a page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ChadS
Forum Newbie
Posts: 4
Joined: Mon Jun 29, 2009 2:46 pm

multiple select statements on a page

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: multiple select statements on a page

Post by requinix »

Depends. What's your code?
ChadS
Forum Newbie
Posts: 4
Joined: Mon Jun 29, 2009 2:46 pm

Re: multiple select statements on a page

Post 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.
User avatar
neuroxik
Forum Commoner
Posts: 25
Joined: Tue Aug 11, 2009 10:32 pm

Re: multiple select statements on a page

Post by neuroxik »

Never tried mysqli (only mysql), but try these just in case:

Line 16:

Code: Select all

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