PHP - Query Wont Display On The Webpage! Urgent
This is the query which should likes salestrack productid with printers productid, but even though there are data no result is showing and I really dont know why. Please help
Code: [Select] SELECT salestrack.orderid AS orderid, salestrack.salesman AS salesman, printers.rrp AS price, salestrack.name AS name, salestrack.phone AS phone, salestrack.email AS email, printers.name AS printername, salestrack.orderdate AS orderdate, salestrack.status AS STATUS FROM printers, salestrack WHERE salestrack.productid = printers.productid AND salestrack.status = 'OPEN' ORDER BY salestrack.orderdate Similar TutorialsHey all, I'm new here at the forum and I'm in bit of a php pickle.
Any Php Jedis out there willing to aid me?
A few months ago I noticed my forum would not load. now I am getting around to reviving it.I received some errors along the lines of something like this:
Notice: Undefined variable: boarddir in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 46 Notice: Undefined variable: sourcedir in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 50 Warning: require_once(/QueryString.php) [function.require-once]: failed to open stream: No such file or directory in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 50 Fatal error: require_once() [function.require]: Failed opening required '/QueryString.php' (include_path='.:/usr/local/php5/lib/php') in /home/content/21/7556421/html/LightWorkerAwakening.com/forum/index.php on line 50That is what loads when you load the address www.lightworkerawakening.com/forum I'm using Simple Machines Forums I installed through Godaddy's web hosting on a Linux server I believe. Godaddy Support said that it may not be loading the cache properly. here is what those lines actually look like in the index.php file: 45 // Make absolutely sure the cache directory is defined. 46 if ((empty($cachedir) || !file_exists($cachedir)) && file_exists($boarddir . '/cache')) 47 $cachedir = $boarddir . '/cache'; 48 49 // And important includes. 50 require_once($sourcedir . '/QueryString.php'); 51 require_once($sourcedir . '/Subs.php'); 52 require_once($sourcedir . '/Errors.php');Please help me Obi wan kanobi, you are my only hope Hi guys, im trying to connect to a database and get the value for the user in the row called 'user_credit', if it equals 1 or more then i want to show the ''You have £ ....'' bit in the script. Problem is nothing shows at all, even without the if statement. I have changed the value for me in the database so in user_credit the value is 100, which is more than 1 so it should appear. I have probably done something wrong. Any ideas? Code: [Select] <? include '../admin/database/membership_dbc.php'; $r = mysql_query("SELECT * FROM users WHERE user_name='".safe($_SESSION['user_name'])."'") or die ("Cannot find table"); while( $cred = mysql_fetch_array($r) ) { if ($cred >= '1' ) { ?> <p>You have £<? echo $cred['user_credit']; ?> available on you account, would you like to use it on this order?<br> <label for="credit"></label> <select name="credit" id="credit"> <option value="Y" selected>Yes, use credit</option> <option value="N">No, save credit</option> </select> </p> <? } } ?> MySQL connection works and it connects to my database but it doesnt insert values into the table that I created. <form action="phplogin2.php" method="post"> Username: <input type="text" name="user" style="color: white; background-color: blue;"/><br/> Password: <input type="password" name="pass" style="color: grey; background-color: black;"/><br/> <button>Login</button> </form> <?php $con = mysql_connect('localhost', 'root', 'eagles1') or die("did not connect"); $dbc = mysql_select_db('mysql') or die("did not connect to database"); $query = mysql_query("INSERT INTO login VALUES('', '$user', '$pass')") or die("query did not work"); $user = $_POST['user']; $pass = $_POST['pass']; if ($con==true){ echo "MySQL Connection Succesful"; } if ($dbc==true){ echo "MySQL Database Connection Succesful"; } if ($query==true){ echo "MySQL Query Succesful"; } ?> Hi, Im trying to get an image to display from a reference in the database but am having no joy. At the minute Im just playing about with PHP to get familiar with it so you can ignore most of the code. The line im interested in is: <td><?php echo "<img src=\"C:\wamp\www\fermpix\Pics\'{$row["Name"]}'\">";?></td> When I view the page in my browser I see the attached. Can anybody see what im doing wrong? Heres the full page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Browse Upload Files</title> </head> <body bgcolor="white"> <?php error_reporting(E_ALL); include 'db.inc'; $query = "SELECT ID, Name, Path, Date, Description FROM Pics"; if (!($connection = @ mysql_pconnect($hostName, $username, $password))) showerror(); if (!mysql_select_db("fermpics", $connection)) showerror(); if (!($result = @ mysql_query ($query, $connection))) showerror(); ?> <h1>Image database</h1> <h3>Click <a href="insert.php">here</a> to upload an image.</h3> <?php //require 'disclaimer'; if ($row = @ mysql_fetch_array($result)) { ?> <table> <col span="1" align="right"> <tr> <th>File Name</th> <th>Date</th> <th>Image</th> </tr> <?php do { ?> <tr> <td><?php echo "{$row["Name"]}";?></td> <td><?php echo "{$row["Date"]}";?></td> <td><?php echo "<img src=\"C:\wamp\www\fermpix\Pics\'{$row["Name"]}'\">";?></td> </tr> <?php } while ($row = @ mysql_fetch_array($result)); ?> </table> <?php } // if mysql_fetch_array() else echo "<h3>There are no images to display</h3>\n"; ?> </body> </html> I would appreciate any help. Cheers Paul Hey guys so my code below is not working, it will get the app information for the user but its only display 3 results like every time a new user "installs" an new app like it stops showing the last result and starts displaying the new result. Like for example right now it should be showing 7 results but only displaying 3 is there something wrong with my query. (PS: this is just developement testing purposes so thats why my code is sorta sloppy) Thanks!
$default_apps = mysql_query("SELECT * FROM apps WHERE `default`='1'") or die(mysql_error()); $user_apps = mysql_query("SELECT * FROM user_apps WHERE `user_id`='$user_id'") or die(mysql_error()); while($row = mysql_fetch_array($default_apps)) { $url = $row['download_url']; $name = $row['name']; echo $row['name']; echo "<a href='$url'>$name</a><br />"; } while($raw = mysql_fetch_array($user_apps)){ $app_id = $raw['app_id']; } $select_user_apps = mysql_query("SELECT * FROM apps WHERE `app_id`='$app_id' "); while($rop = mysql_fetch_array($select_user_apps)) { $name = $rop['name']; $url = $rop['download_url']; echo $name; echo $url; } ok I am getting an error over something simple, can anyone help
Also how do i delete previous threads that I dont wont to continue?
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Post.user_id' in 'on clause' SQL Query: SELECT `Post`.`id`, `Post`.`title`, `Post`.`body`, `Post`.`created`, `Post`.`modified`, `User`.`two`, `User`.`three`, `User`.`id` FROM `jagguy`.`posts` AS `Post` LEFT JOIN `jagguy`.`users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE 1 = 1 class User extends AppModel { public $hasMany = 'Post'; } class Post extends AppModel { /*var $name='User';*/ public $belongsTo = array('User'); } controller //// class PostsController extends AppController { public function home2() { $everything= $this->Post->find('all', array('contain' => array('User'))); } view <?php foreach ($everything as $item): echo '<tr><td>'. $item['Post']['id']. '</td>'; echo '<td>'. $item['Post']['title'].'</td>'; echo '<td>'. $item['Post']['body'].'</td>'; HI im having a problem displaying an image in an iframe or img tag on my php page if i set the source to google it displays fine in the iframe! but if i set the source to a page on my server it doesnt display. It displays in both fire fox and chrome!???? Any help would be greatly appreciated Thanks Sean Hi Guys, I have a php mail script that calculates a branch to send it to dependant on the postcode which works fine as it goes to the right email and when I echo the script to show branch name it comes up with the correct branch name. However when you open the email I cannot get it to display the 'branch name'. It will display all the other bits of information that has been 'posted' from the form. But wont display the branch name form an sql database table. The code below proves that it finds the branch name. while($row = mysql_fetch_array( $result )) { $ter = $row['Ter']; $branchemail = $row['BranchEmail']; $branchname = $row['BranchName']; } This is the PHP Mail in HTML part below <td bgcolor=#FFFFFF bordercolor=#666666 valign=top>' . ( $row['BranchName']) . '</td> But when the email comes through the branch name is always blank. However on this page I can get it to echo the branch name and it displays the branch name and also emails to the branch email address. Any ideas why it doesn't work. Cheers, S Hi i am trying to display image using 'CAT_BIO' => (isset($_GET['c'])) ? '<br />' '<img src="images/' . $row['image'] . ' " width="150" height="200" />' '', but i get the error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in i think a comma or something missing can anyone spot where i am going wrong?? the other way i tried is <img src=\"images/{$row['image']}\" width=\"150\" height=\"200\" />" this one give no error bt doesnt display the anything it might be cz wrong path how do i make to go out one folder the get inside images folder?? not sure if its the solution help I'm using a switch with multiple nested switches. I tested the switch and nested switches by setting up the structure, and using basic text for the cases. For example, instead of one of the nested switch cases needing to = $_GET['id'], I just entered two cases, each equaling 1 and 2, then the default case. Once I begin to enter my SQL coding to connect to the databases, only certain information prints. For example; on my switch that is $_GET['page'], I have a case for 'news'. Inside this case, I have a nested switch called $_GET['id'], which will display information if the page=nes&id=whatever. That works, but when I go do the page=news, nothing displays. My coding is omitting displaying the default information if there is no $_GET['id']. Attached, I am going to have my .php file. The reason for not posting it here is because my coding is rather messy. Please help! Hey, Im having a problem where it wont show the members name only TBA, i was wondering if anyone could spot whats wrong Code - http://pastebin.com/8mEGcTqd page - http://tw.tghq.org/rosters/hto_roster_blistig.php I have a table that needs to display data and its formatting should allow a scroll bar after a bit of length. In this case, the below code seems to allow it to continue well past the footer of the page... Did I miss something obvious? <div class="col-md-12"> <div class="card card-plain"> <div class="header"> <h4 class="title">Current Vendors</h4> <p class="category">Vendors listed as active within VendorBase.</p> </div> <?php $con=mysqli_connect("localhost","root","test","vendors"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM vendor_data"); echo " <div class='content table-responsive table-full-width'> <table class='table table-hover'> <thead> <th>Name</th> <th>Type</th> <th>Company</th> <th>Email</th> <th>SOC2 Report</th> <th>Status</th> </thead> <tbody>"; while($row = mysqli_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['type'] . "</td>"; echo "<td>" . $row['company'] . "</td>"; echo "<td>" . $row['email'] . "</td>"; echo "<td>" . $row['soc'] . "</td>"; echo "<td>" . $row['status'] . "</td>"; echo "</tr>"; } echo "</table>"; echo "</div>"; mysqli_close($con); ?> </table> </div> </div> </div>
Hi all,
I need some help with my code as I've a trouble with sending the emails with images attachments. I'm using Pear Mail library to send the emails so when I send the emails with attachments to gmail, I am unable to see the attached images in my gmail inbox as there is no images show on the bottom of the subject unless when I open on my email so I can see the images attachments. And I am unable to see the images on yahoo when i sent the emails, so I sent a test email on my webmail with the images as attachments and I can see the images on gmail and yahoo with no problem. I think there is a problem with my PHP script that need to be resolve. //attachments if (is_array($email_attachments)) { foreach ($email_attachments as $attachments) { $filename = str_replace('uploads/', '', $attachments); $attachment = ''; $file_path = ''; $type = ''; if (strpos($filename, '.png') !== false) { $type .= 'image/png'; } // ADD attachment(s) $attachment1 .= "--$boundary1\r\n"; $attachment1 .= "Content-Type: $type; name=\"$filename\"\r\n"; $attachment1 .= "Content-Transfer-Encoding: base64\r\n"; $attachment1 .= "Content-Disposition: attachment; filename=\"$filename\"\r\n"; $attachment1 .= "\r\n\r\n"; $attachment1 .= $attachment; $attachment1 .= "\r\n\r\n"; $body .= $attachment1; $mime->addAttachment($file_path, $type); } }
Here is the full code: <?php require_once('Mail.php'); require_once('Mail/mime.php'); require_once('Mail/IMAPv2.php'); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); //Connect to the database include('config.php'); // Connect to the server: $username = 'myusername'; $password = 'mypassword'; $smtp_hostname = "smtp.mydomain.com"; $port = "587"; $attached_files = array(); $inline_images = array(); global $inline_images; if (isset($_POST['send_to'])) { $from = "Mark <name@mydomain.com>"; $to_email = $_POST['send_to']; $subject = $_POST['email_subject']; $message ='<div dir="ltr">' . $_POST['email_body'] . '</div>'; $email_attachments = $_POST['email_attachment']; $total_emails = count($to_email); $email_number = $_POST['email_number']; $sent_message = $message; $attachment1 = ''; $inline_id = 0.1; $success = ''; $base64 = []; $src = []; //Check if the images is base64 if (strpos($message, 'data:image/') !== false) { // read all image tags into an array preg_match_all('/<img.*?src="data:image\/.*;.*,(.*)".*?>/i', $message, $match, PREG_PATTERN_ORDER); $base64 = array_pop($match); if (is_array($src)) { foreach($base64 as $images) { $type = end(explode('/', (explode(';', $images))[0])); $filename = md5(time().uniqid()). '.' . $type; $base64_string = str_replace('data:image/png;base64,', '', $images); $base64_string = str_replace(' ', '+', $base64_string); $decoded = base64_decode($base64_string); $fp = fopen("uploads/". $filename, "w+"); fwrite($fp, $decoded); fclose($fp); } } } //check if the inline images is in the array if (strpos($message, '<img src=') !== false) { // read all image tags into an array preg_match_all('@src="([^"]+)"@' , $message, $match); $src = array_pop($match); if (is_array($src)) { foreach ($src as $key => $value) { $parsed = parse_url($src[$key]); $filename = basename($parsed['path']); $content = file_get_contents($src[$key]); if (!file_exists($filename)) { $fp = fopen("uploads/". $filename, "w+"); fwrite($fp, $content); fclose($fp); } } } } $boundary1 = '###'.md5(microtime()).'###'; $boundary2 = '###'.md5(microtime().rand(99,999)).'###'; foreach ($to_email as $to) { $name = ''; $email = ''; if (strpos($to, ' <') !== false) { $name_str = explode(' <', $to); $email_str = explode(' <', $to); $name = $name_str[0]; $email = str_replace('>', '', $email_str); $email = $email[1]; } $messageID = sprintf("<%s.%s@%s>", base_convert(microtime(), 10, 36), base_convert(bin2hex(openssl_random_pseudo_bytes(8)), 16, 36), 'mydomain.com'); $message_id = getMessageid(isset($message_id)); $now = new DateTime(); $email_id = $now->getTimestamp(); $sent_date = date('Y-m-d H:i:s'); $sent_mailbox1 = $link->prepare("SELECT * FROM sent WHERE message_id = ?"); $sent_mailbox1->execute([$message_id]); $emailID = ''; if (!$name == '' && !$email == '') { if ($name == $email) { $to = $email; } } if ($sent_mailbox1->rowCount() == 0) { $sent_mailbox1 = $link->prepare("INSERT INTO sent (from_email, to_email, message_id) VALUES (?,?,?)"); if ($sent_mailbox1->execute([$from, $to, $message_id])) { $emailID = $link->lastInsertId(); } } //check if the images is base64 if (is_array($base64)) { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } else if (!$base64 == '') { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } //check if the inline images is in the array if (is_array($src)) { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } else if (!$src == '') { $sent_message .= 'http://mydomain.com/u/?id='.$email_id.'&attid='.$inline_id.'&msgid='.$message_id.'&view=attachment&display=view'; $inline_id += 0.1; } $message .= '<img src="http://mydomain.com/track/Images/signature.gif?id='.$emailID.'&etc='.time(). '" ' . 'style="width:0;max-height:0;overflow:hidden" alt="">'; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject, 'Reply-To' => $from, //'Content-Type' => 'Content-Type: text/plain; charset="UTF-8"', 'Content-Type' => 'Content-Type: multipart/mixed; boundary="=_d909e7abc497193ad3b6636530382391"', 'MIME-Version' => '1.0', 'Received' => 'from mail.mydomain.com', 'Date' => date("r"), 'Message-ID' => '<'.sha1(microtime(true)).'@mydomain.com>'); $crlf = "\r\n"; $mime = new Mail_mime(array('eol' => $crlf)); //$mime = new Mail_mime("\r\n"); $html = $message; $text = strip_tags($html); $body = $html; $mime->setTXTBody($text); $mime->setHTMLBody($html); //check if the img tags have url called display=view if (strpos($message, 'display=view') !== false) { $pattern = '@src="([^"]+)"@'; $message = preg_replace_callback($pattern,"setImageLinks", $message); foreach ($inline_images as $inline_image) { $file_path = $inline_image; $typeInt = imagetype($file_path); //code goes here to find the imagetype case switch ($typeInt) { case IMG_GIF: $imageType = 'image/gif'; break; case IMG_JPG: $imageType = 'image/jpg'; break; case IMG_JPEG: $imageType = 'image/jpeg'; break; case IMG_PNG: $imageType = 'image/png'; break; case IMG_WBMP: $imageType = 'image/wbmp'; break; case IMG_XPM: $imageType = 'image/xpm'; break; default: $imageType = 'unknown'; } $mime->addHTMLImage($file_path, $imageType); } } //attachments if (is_array($email_attachments)) { foreach ($email_attachments as $attachments) { $filename = str_replace('uploads/', '', $attachments); $attachment = ''; $file_path = ''; $type = ''; if (strpos($filename, '.png') !== false) { $type .= 'image/png'; } // ADD attachment(s) $attachment1 .= "--$boundary1\r\n"; $attachment1 .= "Content-Type: $type; name=\"$filename\"\r\n"; $attachment1 .= "Content-Transfer-Encoding: base64\r\n"; $attachment1 .= "Content-Disposition: attachment; filename=\"$filename\"\r\n"; $attachment1 .= "\r\n\r\n"; $attachment1 .= $attachment; $attachment1 .= "\r\n\r\n"; $body .= $attachment1; $mime->addAttachment($file_path, $type); } } // always call these methods in this order $mime_params = array( 'text_encoding' => '7bit', 'text_charset' => '"UTF-8"', 'html_charset' => '"UTF-8"', 'head_charset' => '"UTF-8"' ); //$body = $mime->get(array('text_encoding' => '8bit','html_encoding' => '8bit')); $body = $mime->get($mime_params); $headers = $mime->headers($headers); $smtp_params = array ('host' => $smtp_hostname, 'port' => $port, 'auth' => true, // Note 1 'username' => $username, 'password' => $password); $smtp = Mail::factory('smtp', $smtp_params); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Email has been sent!</p>"); $response = array("success"=>$success); echo json_encode($response); } } }
Do you know why the images wont show up on yahoo and gmail when I send the images as attachment?
I have checked on the image path and i have put the correct image path so it should work fine.
Any advice would be much appreciated. Thanks in advance.
Edited June 5, 2020 by mark107 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=309827.0 I have got connection to the the mysql database, how do I get the data from the database to display on the webpage This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=321950.0 i have a register and login page where the users can perform register and login task and their detail gets saved in the database. my requirement is that when the user enters his/her account, they should be redirected to their profile page, where they can view all their profile details. Till now i have been able to make the user login and dislay a part of their profile page, for this purpose the code that i am using is
<code>
<?php Hello all, I have made the multi level marketing downline tree, but the problem with it now, it gives only the downline of one result, as the query gives 2 results what I want now is to make it give the downline of both results not just one, and it's always 2 results, not more here is my code Code: [Select] <?php $id = $_GET['id']; $result = mysql_query("SELECT id FROM users WHERE id = '".$id."' ORDER BY id"); $row = mysql_fetch_assoc($result); if ($row['id'] == 0) { echo" <table> <div id=\".piccenter\""; echo "<tr>"; echo "<img src=\"icon.gif\" border=0 align=\"center\">"; echo ""; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$row['id']."'"; echo ""; echo "</div>"; } } $result2 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$row['id']."'"); $rows2 = mysql_fetch_assoc($result2); foreach ($rows2 as $row2) { if ($row2['id'] == 0) { echo" <div id=\".picleft\"> <img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0 >"; echo "<br />"; echo "'".$row2['id']."'"; echo "</div>"; echo " <td>"; echo "</td> "; } } $result3 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$rows2['id']."'"); $row3 = mysql_fetch_assoc($result3); if ($row3['id'] == 0) { echo"<div id=\".picright\"> <img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$row3['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> "; } $result4 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$row3['id']."'"); $rows4 = mysql_fetch_assoc($result4); if ($rows4['id'] == 0) { echo"<img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$rows4['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> "; } $result5 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$rows4['id']."'"); $rows5 = mysql_fetch_assoc($result5); if ($rows5['id'] == 0) { echo"<img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$rows5['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> "; } $result6 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$rows5['id']."'"); $rows6 = mysql_fetch_assoc($result6); if ($rows6['id'] == 0) { echo"<img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$rows6['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> "; } $result7 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$rows6['id']."'"); $rows7 = mysql_fetch_assoc($result7); if ($rows7['id'] == 0) { echo"<img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$rows7['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> "; } $result8 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$rows7['id']."'"); $rows8 = mysql_fetch_assoc($result8); if ($rows8['id'] == 0) { echo"<img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$rows8['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> "; } $result9 = mysql_query("SELECT id FROM users WHERE recruiteris = '".$rows8['id']."'"); $rows9 = mysql_fetch_assoc($result9); if ($rows9['id'] == 0) { echo"<img src=\"icon.gif\" border=0 align=\"center\">"; } else { echo "<img src=\"images.png\" border=0>"; echo "<br />"; echo "'".$rows9['id']."'"; echo ""; echo " <tr> <td>"; echo "</td> </tr> </tbody> </table> "; } ?> hello all, I am using the following code to retrieve mysql data and show on my page.. Code: [Select] <?php include "dbconnect.php"; $link=dbconnect(); $result = mysql_query("SELECT * FROM playlist where date= '2011-09-06'") or die(mysql_error()); echo "<table width = 100% border = '0' cellspacing = '2' cellpadding = '0'>"; while ($friendList = mysql_fetch_array($result)) { echo "<tr>" . "<td><a href='memberindex.php?id = ".$friendList['id']."'><img src='".$friendList['image']."' title='".$friendList['artist']."' alt='".$friendList['album']."'/><br />".$friendList['album']."</a><br /></td> " . "</tr> "; } echo "</table> "; ?> this code retrieve image and album name from the table and display as below: id 1 image1 album1 id 2 image2 album2 id 3 image3 album3 but i want to display the info as below: id1-----------------id2---------------id3 image1------------image2-----------image3 album1------------album2-----------album3 i want image and album name of a product as column but other product as rows. I hope you understand. anyone can help me with this please? Hello all. I'm using this code to go through the database and output certain user-defined numbers Code: [Select] <?php mysql_connect ("pdb1.awardspace.com", "anastasov_db","moscow1945") or die (mysql_error()); mysql_select_db ("anastasov_db"); $term = $_POST['term']; $sql = mysql_query("select * FROM countries WHERE cocode = '$term'"); while ($row = mysql_fetch_array($sql)){ echo '<br/> Code: '.$row['cocode']; echo '<br/> Country: '.$row['coname']; echo '<br/><br/>'; } ?> Now how would I go about making a page that appears if the script can't find any results in the database? Thank you in advance |