Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: PHP and MySQL 24-Hour Trainer
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: PHP and MySQL 24-Hour Trainer
This is the forum to discuss the Wrox book PHP and MySQL 24-Hour Trainer by Andrea Tarr ; ISBN: 978-1-1180-6688-1
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL 24-Hour Trainer section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 20th, 2012, 09:25 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default LEsson 20 page 264

Code is this:

<?php
$connection = @new mysqli('localhost', 'php24sql', 'hJQV8RTe5t');
if ($connection->connect_error) {
die('Connect Error: ' . $connection->connect_error);
} else {
echo 'Successful connection to MySQL';
}


Output on my computer is this:

connect_error) { die('Connect Error: ' . $connection->connect_error); } else { echo 'Successful connection to MySQL'; }

is something wrong with the (->) in the script?
Reply With Quote
  #2 (permalink)  
Old October 21st, 2012, 01:31 PM
Friend of Wrox
Points: 894, Level: 11
Points: 894, Level: 11 Points: 894, Level: 11 Points: 894, Level: 11
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: London, , United Kingdom.
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Hi willyb,

It looks like your file isn't being interpreted as PHP by the web server. It is just coming down as plain text. Do a view source on your browser and you'll see the php tags.

This means that the browser is interpreting <?php and > as a tag, if a strangely-formed one, and so it does not show on the screen.

So make sure php is set up correctly for that site and the file extension is correct etc.

HTH
Phil
Reply With Quote
  #3 (permalink)  
Old October 23rd, 2012, 02:58 AM
Friend of Wrox
Points: 651, Level: 9
Points: 651, Level: 9 Points: 651, Level: 9 Points: 651, Level: 9
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2011
Location: North East UK
Posts: 125
Thanks: 0
Thanked 24 Times in 24 Posts
Default

Greetings,

Unless you have a class called 'mysqli' with a property of 'connect_error' then the code you provided above is meaningless. Try removing the @ before the new and see what error you get.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lesson 20 Page 152 ThePromise86 BOOK: Knight's 24-Hour Trainer: Microsoft SQL Server 2008 Integration Services 1 January 26th, 2014 10:02 AM
Typo, Chapter 20 page 416 eightbits2011 BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 3 December 16th, 2011 07:15 PM
Chapter 20 page 669 Try It Out Step 4 Frodo BOOK: Beginning Visual C# 2010 1 December 14th, 2011 05:17 PM
Errata: page 20 neutcomp BOOK: Professional WordPress Plugin Development 1 June 15th, 2011 08:21 AM
Try it out, Chapter 20, page 684, step 3 ron-bgsu BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 0 October 28th, 2009 08:52 AM



All times are GMT -4. The time now is 02:11 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.