Jump to content

How do I test and view the results after executing a SQL command?


genzedu777

Recommended Posts

Hi,

 

I am not too sure if I have used the right command, I am using print_r($sql), to view my executed results, but apparently I received mysqli_result Object ( ) , any advice? Thanks

 

$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die(mysqli_error($dbc));
    
    //Run query
    $tutor_id = mysqli_real_escape_string($dbc, $_GET['tutor_id']);

$query = "SELECT tpd.district_id, tpd.district_name, tpz.zone_id, tpz.zone_name     
			 FROM tutor_preferred_district AS tpd
			 INNER JOIN tutor_preferred_dlocation AS tpdl USING (district_id)
			 INNER JOIN tutor_preferred_zlocation AS tpzl USING (tutor_id)
			 INNER JOIN tutor_preferred_zone AS tpz USING (zone_id)
                 WHERE tpdl.tutor_id = '{$tutor_id}'";


$sql = mysqli_query($dbc, $query) 
or die(mysqli_error($dbc));
print_r($sql);

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.