Jump to content

Recommended Posts

I have a shopping basket and i want a user to select from a check box a game that they dont want to buy which they entered by mistake this is what i got so far

$conn = pg_connect("blah blah");

            echo '<form name="hede" method="POST" action="cart.php">';
echo "<table border='5'>";
$res = pg_query ($conn, "SELECT * from Top where $res=e($sql);");
            while ($row = pg_fetch_assoc($res)) {
                echo "<tr>";
                    echo "<td>";
                    echo "<input type=\"checkbox\" name=\"games[]\" value=\"" . $row['refcode'] ."\">";
                    echo "</td>";
                    echo "<td>";
                    echo $row['title'];
                    echo "</td>";
                    echo "<td>";
                    echo $row['description'];
                    echo "</td>";
                    echo "<td>";
                    echo $row['price'];
                    echo "</td>";
                echo "</tr>";
if($delete){
for($i=0;$i<$count;$i++){
$del_id = $checkbox[$i];
$sql = "DELETE FROM Top WHERE id='$del_id'";
$res = e($sql);
        }
}
}
echo "</table>\n";
        echo '</form>';
?>

 

But i think im getting my_sql confused with postgresql any ideas cheers and i need it in postgresql

Link to comment
https://forums.phpfreaks.com/topic/103755-urgent-problem-with-pg_sql/
Share on other sites

Something is very wrong here:

 

$res = pg_query ($conn, "SELECT * from Top where $res=e($sql);");

 

You use pg_query() in the same way as mysql_query(), except the order of the arguments.  So:

 

$res = pg_query($conn, "SELECT * from Top where user = 'foo'");

 

for example

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.