Note that there are some explanatory texts on larger screens.

plurals
  1. POSelect from WHERE query not working
    primarykey
    data
    text
    <p>Thank you everyone for your answers. It was bang on. I changed the spelling and now it is working - it displays the records for the specific user's account. The problem now is that it doesn't execute the query but I'll create a new question for that to avoid confusion.</p> <p>THANKS AGAIN EVERYONE FOR YOUR HELP :)</p> <hr> <p>I'm completely self-made in this area and the moment something doesn't work I don't know where to even look. I was wondering if anyone can spot what's making this code not work.</p> <p>At the moment I've got a very simple query where users on my site can see their billing history summary on a table. I would like them to be able to click on an row to have a full invoice displayed but it's not happening. I took a code that can make such query, but the moment I add where uid=' and paid=Y things stop working. </p> <p>This is the code. Can anyone spot the mistake?</p> <p>Thanks!!! Eugenie</p> <pre><code>&lt;?php include("mainfile.php"); include(XOOPS_ROOT_PATH."/header.php"); $host="localhost"; // Host name $username="username"; // Mysql username $password="password"; // Mysql password $db_name="db name"; // Database name $tbl_name="tbl name"; // Table name // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql="SELECT * FROM $tbl_name WHERE uid='"; $Sql=$Sql . $xoopsUser-&gt;uid("s") . "' AND Paid='Y'"; $result=mysql_query($sql); ?&gt; &lt;table width="400" border="0" cellspacing="1" cellpadding="0"&gt; &lt;tr&gt; &lt;td&gt; &lt;table width="400" border="1" cellspacing="0" cellpadding="3"&gt; &lt;tr&gt; &lt;td colspan="4"&gt;&lt;strong&gt;List data from mysql &lt;/strong&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center"&gt;&lt;strong&gt;Billing Date&lt;/strong&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;strong&gt;Invoice Number&lt;/strong&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;strong&gt;Total GBP&lt;/strong&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;strong&gt;View&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php while($rows=mysql_fetch_array($result)){ ?&gt; &lt;tr&gt; &lt;td&gt;&lt;? echo $rows['date']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo $rows['TicketID']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo $rows['project']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo $rows['grandTotal']; ?&gt;&lt;/td&gt; &lt;td align="center"&gt;&lt;a href="http://website.co.uk/site/viewInvoice.php?TicketID=&lt;? echo $rows['TicketID']; ?&gt;"&gt;View&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php mysql_close(); include(XOOPS_ROOT_PATH."/footer.php"); ?&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