Jump to content

query expects paramater to be string?


turpentyne

Recommended Posts

Stumped on this. I copied the syntax of this from another site I'd done (where it works) Then I changed the query, of course.

But I'm getting an error, that I'm not sure I understand:

The page prints: 451made it to here

Warning: mysql_query() expects parameter 1 to be string, resource given in /home/workshop/public_html/register5b.php on line 20

Resource id #4

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /home/workshop/public_html/register5b.php on line 23

Query failed:

 

And the code is:

 

<?php

if ((isset($_POST['rid'])) && (is_numeric($_POST['rid']))) {
$rid = $_POST['rid'];   

   print_r($rid);
   echo "made it to here";
   // connect to database
include("x.php"); 
    
$query = mysql_query("SELECT tbl_registration.*, tbl_workshops.* 
FROM tbl_registration_workshop  
LEFT JOIN tbl_registration ON tbl_registration_workshop.workshop_id = tbl_registration.reg_id
LEFT JOIN tbl_workshops ON tbl_registration_workshop.workshop_id = tbl_workshops.workshop_id
WHERE tbl_registration_workshop.registration_id = $rid");

$result = mysql_query($query);
   echo $query;
   
    if (mysql_num_rows($result) == 1){

 while ($row = mysql_fetch_array($result)) {
   $workshop = $row['workshop_id'];  
    
?> <!-- from here on, I just print out fields from the data I pull. -->


<?php
     }
    } 


}die("Query failed: " . mysql_error());
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.