Jump to content

buzzkip

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

buzzkip's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. When I use: <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $query = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1' "; $result = mysqli_query($mysqli,$query); while ($row = mysqli_fetch_assoc($result)) { echo $row['message'] . "<br/>"; } ?> I get error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /removedURL/forumdisplay.php(1123) : eval()'d code on line 39 When I take away the set of line 39 and use this: <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $query = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1' "; $result = mysqli_query($mysqli,$query); ?> I get this error: Error Type: Catchable Fatal Error (4096) Error Message: Object of class mysqli_result could not be converted to string
  2. Hi All, I'm trying to echo the response from an SLA query, the query works and returns the data when I test it on an SQL application.. but when I run it on my webpage it won't echo the result. Please help? <?php $mysqli = mysqli_connect("removed", "removed", "removed", "removed"); $sql = "SELECT posts.message FROM posts INNER JOIN threads ON posts.pid=threads.firstpost WHERE threads.firstpost='1'"; $result = mysqli_query($mysqli, $sql); echo {$result['message']}; ?>
  3. table: inplace columns: field, value, stock The drop down displays the value columns perfectly, but when I hit the submit button... nothing happens. <?php //create_topic.php include 'connect.php'; include 'header.php'; echo '<h2>Delete an item in the database</h2>'; if($_SESSION['signed_in'] == false) { echo 'Sorry, you have to be signed in.'; } else { if($_SERVER['REQUEST_METHOD'] != 'POST') { $sql = "SELECT field, value, stock FROM inplace"; $result = mysql_query($sql); if(!$result) { echo 'Error while selecting from database. Please try again later.'; } else { if(mysql_num_rows($result) == 0) { if($_SESSION['user_level'] == 1) { echo 'You have not created any items yet.'; } else { echo 'Before you can post an item, you must wait for an admin to create some locations.'; } } else { echo '<form method="post" action=""> Item: <select name="field">'; while($row = mysql_fetch_assoc($result)) { echo '<option value="' . $row['field'] . '">' . $row['value'] . '</option>'; } echo '</select><input type="submit" value="Delete item" /></form>'; } } } else { $query = "BEGIN WORK;"; $result = mysql_query($query); if(!$result) { echo 'An error occured while deleting your item. Please try again later.'; } else { $sql = "DELETE FROM inplace WHERE value = ' " . $_POST['value'] . " ' "; $result = mysql_query($sql); if(!$result) { echo 'An error occured while deleting your data. Please try again later.<br /><br />' . mysql_error(); $sql = "ROLLBACK;"; $result = mysql_query($sql); } else { $topicid = mysql_insert_id(); $sql = "DELETE FROM inplace WHERE value = ' " . $_POST['value'] . " ' "; $result = mysql_query($sql); if(!$result) { echo 'An error occured while deleting your item. Please try again later.<br /><br />' . mysql_error(); $sql = "ROLLBACK;"; $result = mysql_query($sql); } else { $sql = "COMMIT;"; $result = mysql_query($sql); echo 'You have succesfully deleted your new item.'; } } } } } include 'footer.php'; ?>
  4. Hi all, Please could someone guide me as to how I would create a simple php page, that has a dropdown list populated by a database table - and then a submit button. When I select an option in the dropdown list and then click submit, it deletes the row from the database table. Would be very much appreciative of some help
×
×
  • 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.