Jump to content

kev

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by kev

  1. Hello mac_gyver I thought something similar. I'm in France at present but using a computer and keyboard I brought with me from the UK and my logged on server is in Paris. There doesn't seem to be a standard answer to my problem. Hopefully the problem will resolve itself in about 4 weeks time when I shall be returning to the UK. I'm not sure of the position of the '?' is on a French keyboard I might have a look later. Cheers for the reply.
  2. Hello bsmithers. Video 6_9 is valid for this file as it is part of my file location, I'm following the tutorial and instead of having one index file which would open the file automatically I number them so that I can break down the tutorial into steps for reference, so index_7 identifies at what part of the tutorial I am dealing with. I am also using WAMP with localhost, the url has no problem locating the address that is until I add ?first_name=Whatever I was only required to add to the existing address line ?first_name=Whatever with that done I then pressed enter (not refresh). The url should then locate the file index-7 and open it, it shouldn't read ?last_name=Whatever as part of the address. The file will then read the url address and look for the $_GET has now been set using ? from there it should update the db. P.S I did rename index_7.php to index.php, the problem still exists.
  3. So far so good. I've reset with backticks and used single quotes within exit('$_GET not SET - '.print_r($_GET,true)); First result = Connected$_GET not SET -Array ( ) This is what I would expect and it also proves the connection to the db. The next bit is the bit that counts and that is entering ?first_name=whatever into the url and press return. Now with $_GET set when return is pressed it should update the db by inserting another record with a first_name of whatever but it doesn't it returned the following 'a bog standard search'. Your search - localhost/phpacademy/MySQLi/Video 6_9/index_7.php?first_name=whatever - did not match any documents. My problem is that I cannot see any coding error, my code was faithful to the tututrial code (which did work) but I cannot get the url input to function. One thing that shouldn't but may be a problem is that at present I am in France with a UK orientated computer and keyboard.
  4. Hello joel24. Thanks for replying. I followed your directions. First I did originally get the connected message and still got connected with following your instructions. No problem there. I didn't get a return from 'FAILED WRITING' I did have a problem with: exit("$_GET not SET - ".print_r($_GET,true)); With the " " in place, error report = Notice: Array to string conversion in C:\wamp\www\phpacademy\MySQLi\Video 6_9\index_7.php on line Without the " " in place. error report = Parse error: syntax error, unexpected 'not' (T_STRING) in C:\wamp\www\phpacademy\MySQLi\Video 6_9\index_7.php on line 21 kev
  5. Hello IanA and bsmither.. Thank you for replying. There is no form, The tutorial exercise that I was following was a demonstration on how to insert records into a db via the url, the sort of thing an admin might do. This can be done at the C/: prompt but that wouldn't solve the problem that has arisen.
  6. I am attempting to insert data into a db via '?' in the url. The demonstration I've seen appears to work fine. I am using Wamp 2.2, Apache 2.2.22, PHP 5.4.3 and MySQL 5.5.24. My efforts merely take me off on a standard search. Has the global $_GET changed. My code. <?php //error_reporting(0); require 'db/connect.php'; echo 'Connected'; //Added to be sure to be sure connected if(isset($_GET['first_name'])) { $first_name = trim($_GET['first_name']); if($insert = $db->query(" INSERT INTO people(first_name, last_name, bio, created) VALUES ('{$first_name}', 'Garrett', 'I\'m a web developer', NOW()) ")) { echo $db->affected_rows; } } ?> After the file is initiated the idea is to enter into the url ?first_name=Whatever press enter, the file should run and at the same time update the db. What am I missing. kev
×
×
  • 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.