473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Web browser suddenly not reading PHP?

2
First, let me state I'm a newbie. I'm in the second chapter of "PHP and MySQL Web Development." You build a script in the book, and mine worked just fine yesterday. Now it looks like none of the PHP code is being processed. That script is a little long, so I'll just show my test script to show what's wrong. The top 3 lines are taken from the self-help portion of this website.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.   error_reporting(E_ALL);
  4.   ini_set('display_errors', true);
  5.   mysql_query($query, $link_id) or die('<hr />MySQL Error: ' .mysql_error(). '<hr />');  
  6.  
  7.  
  8.  echo '<p>'.'basement'.'</p>';
  9.  
  10. ?>
  11.  

The result is

MySQL Error: ' .mysql_error(). ''); echo '

'.'basement'.'
'; ?>

with a <hr> below the MySQL line.

Anybody have a reason it stopped working? I don't think I changed anything, and it was working yesterday.
Jan 20 '09 #1
7 1932
Dormilich
8,658 Expert Mod 8TB
there is no database connection made prior to the mysql_query() call. see PHP: MySQL - Manual and PHP: mysql_connect - Manual
Jan 20 '09 #2
Atli
5,058 Expert 4TB
Hi.

If you do "View Source" in your browser, do you see the entire PHP code?
If that is so, then your server is indeed processing your PHP code as plain text.

If it worked yesterday, then something must have changed. Servers don't usually just decide to drop a module for the hell of it :]
(Unless your using Windows, of course... you never know what that system is up to :P)
Jan 20 '09 #3
Dormilich
8,658 Expert Mod 8TB
I could imagine, that (for the rare chance of it) you might have mistaken '' for " somewhere (2 single quotes vs. 1 double quote) which would result in some code actually interpreted as text.
Jan 20 '09 #4
Atli
5,058 Expert 4TB
Yea, that is a remote possibility.
Although, you would be very *unlucky* if the quotes matched in such a way that it would not produce a syntax error.
Jan 20 '09 #5
ricem
2
Okay, it turns out I'm retarded. It wasn't working because I turned retarded overnight and forgot everything I learned. Turns out I was opening the pages in a browser instead of //localhost/. It works okay now. Someone I became unretarded overnight, but I still feel retarded. Sorry to waste your time. And the reason the code looks so weird is I think it went from the < in <?php to the > in hr /> Perhaps next time I will wait a couple days before asking for help to see if I become unretarded first.
Jan 20 '09 #6
Atli
5,058 Expert 4TB
Don't worry about it. We all have spastic moments from time to time.

It helps to post it tho. Usually makes the problem seem clearer when you try to summarize it in a post.
And if that doesn't help, we are always happy to point it out for you :]
Jan 20 '09 #7
Four years and four months after the last message on this thread, I must say you guys saved me the trouble of removing and reinstalling xampp and going back to the beginning of the book. I had the same issue and, just like ricem, I feel retarded. The echo of the code I created for testing this problem actually said "you, sir, are an idiot". Worthy of a proper Nostradamus...
May 9 '13 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
4
by: Corepaul | last post by:
I am working in Windows 2000 and Access 2000 and am a rookie in Access. Coding merrily along, I stop periodically to test that everything works. After adding a small amount of code to several...
2
by: Christopher | last post by:
We have a specific javascript call made from a standard HyperLink control that is opening up a link in a new window using the window.open javascript function. The page is on ASP.NET. Up until a...
3
by: Jason Chu | last post by:
I've written a file uploading part of my application using the IHttpModule. So now, I don't have the memory problem of uploading something big. Problem: I can't find which function I have to...
9
by: rajasekhar | last post by:
Hallo, I am developing a site, and here whats the problem is: how to partition the code, i.e. if I developed 1000 lines of code, in that I want to show first 200 lines only if the user opens my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.