Note that there are some explanatory texts on larger screens.

plurals
  1. POMYSQL Code Not Pulling Info
    primarykey
    data
    text
    <p>I'm writing my social network, and when a post is displayed on the newsfeed, the profile picture, and writer's name will not show. Here's my code: </p> <pre><code>$owner_id=mysql_result($result,$i,"post_owner_id"); //Post writer's user ID $content=mysql_result($result,$i,"content"); //Content of the post $date=mysql_result($result,$i,"date"); //Date $time=mysql_result($result,$i,"time"); //Time $poi_query=mysql_query("SELECT firstname, lastname, profile_picture FROM users WHERE id = '" . $owner_id . "'"); //MYSQL query to get the information of the post writer using user ID $post_firstname=mysql_result($poi_query, 0, "firstname"); //Writer's first name $post_lastname=mysql_result($poi_query, 0, "lastname"); //Writer's Last name $post_profile_picture=mysql_result($poi_query, 0, "profile_picture"); //Writer's profile picture ?&gt; &lt;div class="post"&gt; &lt;h1 class="post-title"&gt;&lt;a href="profile.php?user=&lt;?php echo $owner_id; ?&gt;"&gt; &lt;?php echo $post_firstname; ?&gt; &lt;?php echo $post_lastname; ?&gt;&lt;/a&gt;&lt;/h1&gt; &lt;p class="content"&gt;&lt;?php echo $content; ?&gt;&lt;/p&gt; &lt;p class="details"&gt;&lt;?php echo $date; ?&gt; at &lt;?php echo $time; ?&gt;&lt;/p&gt; &lt;br/&gt;&lt;hr/&gt;&lt;br/&gt; &lt;/div&gt; </code></pre> <p>Everything else works perfectly fine besides the name and picture. Any help? I'm almost positive it has to do with the poi_query... And by the way, all the code works fine in the terminal if I manually input the user ID's.</p> <p>Config.inc: </p> <pre><code>&lt;?php $hostname = 'localhost'; // Your MySQL hostname. Usualy named as 'localhost', so you're NOT necessary to change this even this script has already online on the internet. $dbname = 'social-network'; // Your database name. $username = 'root'; // Your database username. $password = '********'; // Your database password. If your database has no password, leave it empty. // Let's connect to host mysql_connect($hostname, $username, $password) or DIE('Connection to host is failed, perhaps the service is down!'); // Select the database mysql_select_db($dbname) or DIE('Database name is not available!'); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload