Jump to content
Larry Ullman's Book Forums

Jonathon

Members
  • Posts

    1064
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Jonathon

  1. Your using mysqli to execute the query but connecting using mysql. You need to use one or the other, you can't mix them.
  2. DEFINE ('DB_USER', 'root'); DEFINE ('DB_PASSWORD', ''); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'what_ever_your_db_is_called'); Is the general set up of XAMPP unless you have altered these
  3. Try this at the very top of a new page <?php $link = mysql_connect('localhost', 'your_username', 'your_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?> see if it connects now. I don't think you have mysqli enabled, you hsould be able to do this: look in your xampp/php/ folder for a file called php.ini then look for mysql or mysqli and see if you can find that line and then remove the ';' to enable the mysqli functions it should be this line i think extension=php_mysqli.dll make sure the ; that is probably there before the start of this line is removed. Then restart apache and run phpinfo() try and find mysqli again
  4. Ok, so your using XAMPP If you put this line in your code phpinfo(): it should bring up a big long list of available settings. I'm sure Larry mentions it in his book prior to this example. search on the page for mysqli and see if it says enabled. Let me know
  5. Is this a server on your PC or your live server? Check with your host or the php.ini file on your local server to see if you have mysqli function,s you possibly may only have the mysql_connect available to you. phpinfo(); will tell you
  6. I would imagine that DEFINE ('DB_HOST', 'MySQL'); should really be DEFINE ('DB_HOST', 'localhost'); also remove the error supressor @ symbol before mysqli_connect,it may help you determine what the error is.
  7. That doesn't look like the rules are directed for the root. Sorry, my first message was probably misleading i'd just woken up! What i meant was, put the files in the root and also the .htaccess file
  8. From my experience it's a lot harder to to work with .htaccess files when they're not in the root folder. I would try to do this example in your http://localhost/ folder.
  9. I don't know but I would imagine that you couldn't connect with one language (Perl) and then use another language (PHP) to manipulate that database connection. (However, i don't actually know this for sure)
  10. Thanks Fergal , to respond to your statement, no, I do not have the book. I won a copy of it though when it was released, but I thought the competition was for Larry's 4th edition of PHP and MySQL, so Larry kindly let me exchange my copy of the book for the new PHP and MySQL book when it comes out - Thanks Larry!
  11. I shall try to help you, but you must appreciate I don't have the book and therefore can't see the context it's written in. 1. Statement - typically a statement is used in conjunction with an "if" hence an "if statement" example if( 1 == 1) The (1 == 1) is a statement that you are checking is correct or not. 2. Executable - executable means to be able to execute or run something. Often you will hear someone say a file is executable. However what context this was used in i'm not sure. 3 & 4. Refers to how a language is run, PHP is an interpreted language and is ran by an interpreter program compiled languages, I would struggle to explain compliers. 5. Attributes depends what context this is written in, do you have an example? 6. Function - a function is a series of code that does a certain job. Often you'll find that a function is often reused. function myFunction () { echo 'This is out put from the function'; } Then you can call this function from your executed script like so: (as you should really separate logic(functions etc) from your code <?php require ('../folderforfunctions/functions.php'); myFunction(); // would echo out "This is output from the function" 7. Argument - Arguments are passed to functions. For instance function myFunction ($name) { echo "My name is $name"; } require ('../folderforfunctions/functions.php'); $name = 'Jonathon'; myFunction($name); // would echo "My name is Jonathon" PHP has it's own built functions too 9. Language constructs are often mistakenly referred to as functions that are built into php. Things like stripos() is a PHP function, things like array() and echo() are language constructs. I wouldn't really worry about the technicality around them. But they operate slightly differently, and you would use them in different ways, take for example these language constructs require, require_once, empty,echo,array,unset,include,isset. You might not know what they all do yet, but you'll see that they differ from functions as you go through the book i'm sure. Hope that helps, I wouldnt worry about your list of items you don't understand, you'll get to grips with that as you have more experience with the language.
  12. HostGator is my vote, I hear good thinks about ipage too.
  13. Hello Irene, Simply the first error means that it can't find your mysqli_connect.php file. The DB_HOST on a lot of live websites is simply 'localhost' Where is the location of the mysqli_connect file in relation to your executed script?
  14. I can't remember the precise code for this example. But I think the data is stored in the $_SESSION. So you can query the $_SESSION to see if it's empty. If it isn't then query the $_SESSION to find out how many items you have and print this to the page.
  15. Firebug is a plugin for Firefox, Google also have a similar tool too, so no need for a new editor.
  16. If your going to build in a non ajax layer, then won't you have a php version if you can't create an ajax object and have an ajax layer ready if the object can be created. So aren't you covered anyway?
×
×
  • Create New...