Corey
Jan 27 2005, 07:16 PM
i have a problem with this script... it should display a content from a row in mysql database...defined by variable $id CODE <?php include "db.php"; $query = "SELECT title, content FROM articles WHERE id='$id'"; $article=mysql_query($query);
while ($r=mysql_fetch_array($article)) { $title=$r["title"]; $content=$r["content"]; echo "<b>$title</b>"; echo "<br><br>$content"; } ?>
the problem is that it displays only the content from the last row in the mysql database...but not the content defined by $id (...WHERE id=$id...) ....something is strange...because the script worked in the morning...and i've changed something...and it doesn't..??? then i uploaded the old file on the server (that worked) and nothing?..the same thing again... please help me.... btw the script is a part of "article system"...
Reply
Corey
Jan 27 2005, 09:22 PM
it's OK now...i solved the problem my self  ..tnx anyway;)
Reply
Roly
Jan 28 2005, 06:35 AM
This is the way I would code your script >_> CODE <?php include 'db.php'; $article=mysql_query('SELECT title, content FROM articles WHERE id = \''.$id.'\''); while ($r=mysql_fetch_array($article)) echo '<b>'.$r['title'].'</b><br /><br />'.$r['content']; ?> Don't waste your time coding unessesary stuff like extra variables or two echo functions when you only need one. BTW using single quotes is faster
Reply
Similar Topics
Keywords : php, mysql, problem
- Billing Problem. Plz Help
(2)
Problem With My Pc
crashes very frequently (2) My home PC has got a very seious problem....i took it about half a year ago..and in these six months
it has come up with more problems than my 6 year old PC.... It crashes very frequently...i have
tried good antivirus programs and i maintain it well too ...actually i have stopped doing it now
because every week during start up, a black screen shows up and the OS fails to load.... I then
reinstall XP and then again hope that it survives for another week... i am fed up of ths
reinstallations as it consumes the whole day....... The problem is..I still don't know what ....
Problem Concerning Credits Reduced
Reduced when I created a hosting account (12) My free web hosting account request for the second package was approved, which means that at the
time of the request (the topic itself) or the topic, however you want to name it, i had something
over 37 credits, positive and green of course, and when the admin actually approved the request, and
we all know that exactly when we see some changes on the request topic title, for instance, the
addiction of the words: "denied", "approved", et cetera. The point is that when the admin approved
today i had about 45 or 47 credits, and i created then the hosting account that only....
Problem With Hosting
delete it or wait it out? (4) Okay all I need help and or advice of this problem or delema. I have already posted that I have a
problem with logging into my cpanel, and have had replys of what to do, none worked. I have left a
ticket with xisto and no reply. Right now I am about to go Nuke over this. as some of you know my
site is a weather site and we have 2 systems on the east coast of the us. My problem is should I
wait this out and let the credits I have be used. "cant even access my own site" or save them and
just resign up and hope that takes care of the problem. Or even worse leave trap17 a....
What Is My (power) Problem?
(4) Hey all: I have a problem with my desktop. I have replaced the PSU a few times but now have a new
problem. When I turn on the power the green led on the asus motherboard glows green, but it is a
dull green and I cannot power up the machine. After some time (30-60 secs or more) it turns bright
green and I can power up. Then sometimes I am in the middle of working and the power will just
reset. When the computer boots up it starts loading the drivers then reboots again and keeps doing
this so it keeps rebooting and rebooting and rebooting and rebooting and rebooting ....
Attachment Problem In Pmwiki
The photos uploaded in PmWiki do not show themselves in the pages (0) Hi, I recently added PmWiki to my website. It is a great software, both light-weight and useful
with a lot of extensions. But a thorn is still in my side which is the attachments problem. When I
upload photos in a page the attachment just shows up like a text link which points to the uploaded
image without any image display. So I got stuck where I decided to make some profile pages for my
club members. Anybody here knows what to do? I have a little experience with PmWiki but I suggest
it to you if you do not want to be over killed by a system like what Wikipedia use....
Problem With The Trap17 Forum
Inconsistent links and problems with "Latest Activity" (4) Hi, I have noticed a bit of a problem with the forums here on Trap17. I don't know if this is a
problem with the Trap17 implementation, or with Invision Power Board in general, or with a mod that
is running on the forums here, and I'm sure that someone smarter than me can isolate the source
of the problem. What I have noticed firstly is that the link that is generated in the top right
corner of a post within a thread, the link to that particular post (I'll call that the linkback
link), sometimes links to the post itself, but often just links to the thread. T....
Mysql Hacks
(1) There are MySQL hacks out there, They can travel from your website to your computers. One of these
are the MySQL injectors. The injection drops your tables and shuts down the program permanently. Be
careful of these hacks, as they can destroy your MySQL related websites, programs, etc.....
Counter Strike Problem
steam validation (2) Heloo i get a probelm steam validation rejected does anyone know how to fix it ?? i tried everything
im going to contact steam support to see if they can fix but can you guys help me?....
Hosting Credits Problem? [resolved]
(9) Hi. Last night I had HOSTING CREDITS : 29.67 DAYS credits. Now I have HOSTING CREDITS : 7.06 DAYS.
How on earth did they get reduced that quickly? I am so confused. Any help please?....
Firefox 3 Cookies Problem
It is reeeeeeally annoying (4) Hello The person who finds a solution for my problem would really be a life saver for me. I've
tried searching all over the web. Whenever I try to visit phpbb2 forums, I have to clean my cookies
before logging in, and this sux. I also get yahoo and google bad request errors. Here is the google
bad request: CODE Google Error Bad
Request Your client has issued a malformed or illegal request. Please see Google's
Terms of Service posted at http://www.google.com/terms_of_service.html ....
Creating A Php Login System Using Mysql
I need help in creating a login system, what I want is a login system (10) Hey everyone! I am helping someone make a login system using MySQL databases and a PHP login
form. I have a fair bit of experiance in HTML and some javascript too. I have virtually no
experiance in MySQL or PHP. Anybody know of any good PHP login systems that allow you to creat a
personalised page for each user and when they login the system transfers the user to their page.
Another thing that the system MUST have is a way of stopping unwanted users entering someones page.
CODE For example lets say I register and my UN is jesse123 and my personalised pages a....
Mysql Database Not Working
(3) well i'm getting an error message(a databass connection warning) for all of the parts of my site
that connects to a mysql database i check my database users pertmissions and i try to do the repair
database thing and it's still not woeking. am i the only person having this or is it an overall
trap17 issue and how do i fix it.....
The Only Reason I Choose Ms Sql Server Rather Than Mysql
(0) The only reason i choose ms sql server rather than mysql is, MS SQL has more security
features!! MySQL is lacking a lot in my opinions - Lack in wide char, like nvarchar, I
developed some application to support chinese letter, and dont know how to build one in mysql - Lack
in t-sql syntax, like query in query is not fully supported - Does not have today SQL features like
BI support (today really required) And compare MS SQL to MySQL, the only reason why mysql is
favourable is - it is free! Dont u guys agree?....
Need Advice On Setting Up Mysql Database.
I have a huge amount of daily data updates to be inserted. (4) First of all, to get the idea of what I am trying to achieve here, please have a look at my
idea thread, entitled Idea For Using A Cron Job To Grab Daily Travian Map.sql Updates . This gives
a prelude to the project, what it is for, what it is supposed to do, etc. Now, what I need is
specific advice on setting up the mySQL database(s) to implement this idea. There is a useful FAQ
file for how to make use of the map.sql data located on the help.travian.com website, which also
gives an example of the CREATE TABLE instruction that matches the data in the map.sql fi....
Problem With My Girlfriend Family, Need Suggestions For Action
Problem with my girlfriend family, need suggestions for action (2) It's been nearly 3 months that I am in abroad for my future study. Many things happened
/ohmy.gif" style="vertical-align:middle" emoid=":o" border="0" alt="ohmy.gif" /> in these 3 months
back in my home country. I had a girl friend /biggrin.gif" style="vertical-align:middle"
emoid=":D" border="0" alt="biggrin.gif" /> and both of our parents know that we are seeing and
dating each other and want to tie knot /tongue.gif" style="vertical-align:middle" emoid=":P"
border="0" alt="tongue.gif" /> in near future. We desperately love each other. Everything is going ....
Pop-up Virus / Trojan Problem
Constant pop-up, won't go away (10) Hi Guys, Lately I have had this same annoying pop-up dialog box pop up that says: QUOTE NOTICE:
If your computer has been running slower than normal, it may be infected with Viruses, Adware, or
Spyware. Adwareremover2007 will perform a quick and completely FREE scan of your system for
malicious programs. Download AdwareRemover2007 for FREE now! I have scanned it with Avira
AntiVirus and ad-aware2007. They both returned infected files, which i deleted, but i still have the
pop-ups. Any ideas?....
Sharing Files And Printer Between Windows Vista And Xp
Networking Problem (9) I have set up a wireless network between my two computers one vista and one XP I can access the
shared files from the vista machine on the XP PC but I cannot access the shared files or printer
which are on the XP PC via the vista one I don' think it is a firewall issue. Can anyone help
please it is driving me mad?? /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0"
alt="biggrin.gif" />....
Dandruff Problem
(29) I am a average built, Indian, Male, aged 20 person. I have a very serious problem with the
dandruff. It comes back within an hour after taking a head bath. It is bothering me a lot. It is
very itching and really irritating. I have tried applying lemon on my head but in vain. The dandruff
still comes back. My mom advised me not to apply lemon too much on head so I have stopped applying
that also on head. I went to a doctor and he asked me to shampoo hair with a medicated shampoo
called SELSUN. But still the dandruff problem is lasting and with no effect with the medic....
Laptop Keyboard Problem
Dell Inspiron 6000 (8) First post on here and here it goes.... I got a laptop the "A" button now doesn't work. I pryed
off the black top to check if any dirt or liquid is under there and cleaned it put it back on and it
still doesn't work. I ordered a keyboard for my laptop off ebay. Now how exactly do i take off
the old one and put a new one in? Thanks....
Remote Assistance Problem
Won't work (9) I have tried tons of times and i can not get it too work. I did't even know about this until
Paul from Trap 17 used it to help me with something on my site. Whenever i try it, it never
connects. I have tried all three ways. Email, MSN, and download the file and send it. Both computers
are connected to the internet. On microsoft's site they have a lot of people with the same
problem, but no one ever helps with it. They are all unanswered. Paul: If you read this i know you
know how to do it.....
Quick Question
Is there a limit on the size of the MySQL database? (10) Question's in the title!....
Upload Component - Failed
Problem with Mambo (6) Hello! When I am trying to upload a component in joomla (I upgraded from mambo, I had the same
problem on mambo), it dont work, i get this error message: ! Upload component - Failed" "File
/home/esector/public_html/Gamesector/media/install_4381d76108f20/com_forum.zip does not exist!
" How can I fix it?....
I Have A Girl Problem Here
I like this girl and she likes me (27) Ok I have a girl problem here. I like this girl and she likes me back but there is a small problem.
She already has a boyfriend. I want to go ask her out but as you see she has a boyfriend. So my
question is what should I do. We are good friends and know each other pretty well.....
Mysql Database Size
related to the free database space (7) hi all! this is my first post /biggrin.gif' border='0' style='vertical-align:middle'
alt='biggrin.gif' /> and i have a doubt, how much mysql space i am allowed to use... i mean how
much is available for my free account....
Problem Installing Sims 2 Nightlife
update failure (26) I have the Sims 2. I tried to install Sims 2 Nightlife expansionpack. He reches 100 % with
installing the game...then he automatically run the updat for the sims 2. But when he's going
trough the files he stops st the file: CSBin/package.exe He says there is a error, and then when I
click ok, install terminates and goes back from 100% to 0%. Can anybody tell me what's going
wrong here? Has anyone else had this problem? I just can't figure it out. And on the internet I
found a few people who had the same problem but just havent had an solution for it yet. Ca....
Import From Excel File Into Mysql Database
(11) Has anyone tried using the excel import function that comes with phpmyadmin
http://www.phpmyadmin.net/home_page/ - it does not require any additional plug-ins or scripts and
is fairly straightforward to use. In phpmyadmin, if you click on the database table which you wish
to import the data to , there is a link on the bottom left corner which says "insert data from a
text file into the table" - although it says text file it still can be used to import an excel file.
When you click on this link you will be taken to a page where you will be asked for the file name
(the....
60 Seconds Countdown That Shutdown The Pc
Problem in computer that automatically restart COMPUTER (15) I encountered this bugs or what 6 months ago, untill now still gives me a headache. I don't
know if it is a virus, problem in windows services or what but honestly I cant fix it. What it does
is, it's gives you an error message saying blahh blahh...with a timer of 60 seconds, when the
timer reached 0 it will automatically restart your computer.....
Did You Face Problem Opening Pdf With Firefox?
(15) Hello, I have a question to ask since the 1st day of my download of firefox ... Whenever i open a
pdf file online using firefox, the firefox is get not responding and my comp got hanged ... i have
to manually end the firefox program via windows task manager .. I tried to wait the pdf to load, but
it seems that it takes forever .. so im guessing it's the trail version's bug .. but after a
few updates, I still have the problems with my firefox ... Is this my computer's problem or
firefox problem ? If it's a firefox bug, it's impossible that no1 report ....
Mysql Database Setup : Setting Up Mysql Database
Guide to use MySQL database in your site (6) A SMALL INTRODUCTION TO DATABASE ============================= I have seen that many members have
problems with Database. Here is a small INFO which should give you the IDEA. mySQL is a DATABASE
server. You can access it using the link in Cpanel. Cpanel can be accessed by
"www.YOUR-SITE.com/Cpanel" There you have 4 Main Options :- 1> CREATE A DATABASE 2> CREATE A USER
3> ADD USER TO DATABASE 4> PHPMYADMIN CREATE : IT ALLOWS YOU TO CREATE A DATABASE CREATE USER
: IT ALLOWS YOU TO CREATE A USER. USING THIS, YOU CAN ACCESS THE DATABASE. A DATABASE CANNOT BE....
Looking for php, mysql, problem
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for php, mysql, problem
*MORE FROM TRAP17.COM*
|
advertisement
|
|