Jump to content

Corbokhan

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.givingjoe.com

Profile Information

  • Gender
    Not Telling

Corbokhan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I actually just figured it out. I needed to add quotations. Been a long night! Thanks for the quick response though.
  2. Hey everyone, I'm having some trouble with a delete query that I can't quite figure out. When I delete one item using the query, "DELETE FROM APPS where appID='1' AND userID='1';" the query works fine and the row is deleted. When I delete one item at a time but use multiple queries the rows are not deleted. For example, I would call "DELETE FROM APPS where appID='1' AND userID='1';" and then "DELETE FROM APPS where appID='2' AND userID='1';" - Neither row is deleted. Finally when I delete multiple items using one query , "DELETE FROM APPS where appID='1' OR appID='2' AND userID='1';" - Neither row is deleted. Each of these queries work when I paste them directly into phpmyadmin, but not when using myslqi_query on a webpage. Any ideas why these queries aren't running successfully? [edit] Also, the queries that are not successfully running do not come back with an error message, they just do not perform the task.
  3. Hello everyone, I'm trying to set up a website for an organization that requires its members to make payments. I'm trying to set it up where users can pay online and it deposits directly into the organization's bank account. Is this possible? Or are their any other suggestions to make something similar to this work? Thanks in advance.
  4. Hello everyone, I have a PHP script allows users to upload a zip file with JPG images to a server. The script unzips the folder and renames it. The issue I am having is in regard to the actual .zip files. When I create a zip file on a Mac, everything works fine, but when I create a compressed file on Windows the script fails. I'm assuming that there is some type of different signature for a Windows .zip folder and a Mac .zip folder. Any suggestions for what I can do? Thanks in advance.
  5. Line 39 starts with $query. 111 is the error code.
  6. I'm pretty new to PHP and I'm having trouble inserting data into my database from a webpage. Here is the code. The error is on the lines with $query and $result. The error comes back: Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/content/76/5697876/html/corbinreynolds/insert.php on line 39 Lost connection to MySQL server at 'reading initial communication packet', system error: 111 I've been working at this for hours and can't seem to figure this out. Any ideas? <?php $first=$_POST['first']; $last=$_POST['last']; if (!$first || !$last) { echo 'Error: Enter the required data.'; exit; } if (!get_magic_quotes_gpc()) { $first = addslashes($first); $last = addslashes($last); } $hostname = '127.0.0.1'; $username = 'root'; $password = 'root'; $dbname = 'phonebook'; @ $db = mysql_connect($hostname,$username.$password,$dbname); if (mysqli_connect_errno()) { echo 'Errer: Could not connect to database'; echo '<br>'; echo mysqli_connect_error(); exit; } $query = "INSERT INTO contact (first,last) VALUES ('$first','$last')"; $result = mysql_query($query,$db) or die(mysql_error()); if ($result) { echo $db->affected_rows." contact inserted into the database"; echo 'Contact Entered: '.$first.' '.$last.''; } else { echo 'Error: Contact not added.'; exit; } echo 'Closing Database'; $db->close(); ?>
  7. I changed local host to 127.0.0.1 and changed the mysqli() to mysql_connect() and it now works. Thanks a lot for the help!
  8. I changed $hostname to 127.0.0.1 and this error comes back. Can't connect to MySQL server on '127.0.0.1' (111) Is that what you were referring to? Replacing "localhost" with "127.0.0.1"?
  9. mysqli_connect_error() says" Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  10. It just echos what I have listed in the If statement.
  11. I'm looking to connect to a MySQL localhost on my mac. I've been working for a few hours at this and I still can't figure it out. Below is my code. I've tried a number of different ways to connect to the database including using new mysqli, mysql_connect and PEAR MDB2. Any suggestions as to what I can do? Thanks in advance. <?php $first=$_POST['first']; $last=$_POST['last']; if (!$first || !$last) { echo 'Error: Enter the required data.'; exit; } if (!get_magic_quotes_gpc()) { $first = addslashes($first); $last = addslashes($last); } $hostname = 'localhost:8889'; $username = 'root'; $password = 'root'; $dbname = 'phonebook'; @ $db = new mysqli($hostname,$username.$password,$dbname); if (mysqli_connect_errno()) { echo 'Errer: Could not connect to database'; exit; } echo '.....Connected Successfuly'; $query = "insert into contact values ('null','".$first."','".$last."')"; $result = $db->query($query); if ($result) { echo $db->affected_rows." contact inserted into the database"; echo 'Contact Entered: '.$first.' '.$last.''; } else { echo 'Error: Contact not added.'; exit; } $db->close(); ?>
×
×
  • 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.