TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-11-2008, 01:18 PM   #1 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Application Go personal messages system

hi im trying to do a personal messages system in my script
and i had few problems
is there someone than can help a little bit with some tips
thanks already


ok this script didnt work why !!
PHP Code:
$wom="SELECT * FROM `coms`";
$man=mysql_query($wom);
while(
$car=mysql_fetch_array($man)){
   
$sendername=$car['sender'];
}
   echo 
"By : ";
   echo
"<a href='msgs.php?member=$_COOKIE[user]'>".$sendername."</a><br>"
__________________

Last edited by webtuto : 01-11-2008 at 02:22 PM.
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-11-2008, 01:28 PM   #2 (permalink)
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

That's a very vague question webtuto, can you elaborate on what part of the script you actually need help on?
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote
The Following User Says Thank You to Karl For This Useful Post:
codefreek (01-12-2008)
Old 01-11-2008, 01:33 PM   #3 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

karl i edit the thread u can see the code
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-11-2008, 01:49 PM   #4 (permalink)
The Contributor
 
buggabill's Avatar
 
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
buggabill is on a distinguished road
Default

Webtuto, could you be more specific? Are you getting error messages? Are you looking to optimize the code?
What's up?
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
buggabill is offline  
Reply With Quote
Old 01-11-2008, 01:54 PM   #5 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

You are not using $car anymore in the code, and we don't see $oop and $row being created. Are you sure they exist? And $oop[com] may give problems on some PHP servers, use $oop['com'].

Hope this helps a bit :)
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 01-11-2008, 02:09 PM   #6 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

Quote:
Originally Posted by Jim View Post
You are not using $car anymore in the code, and we don't see $oop and $row being created. Are you sure they exist? And $oop[com] may give problems on some PHP servers, use $oop['com'].

Hope this helps a bit :)
its a big page not just this little script the problem that i have is in here =>


PHP Code:
$man=mysql_query("SELECT * FROM `coms` ");
$car=mysql_fetch_array($man);
   echo 
"By : ";
   echo
"<a href='msgs.php?member=$_COOKIE[user]'>".$row['sender']."</a><br>"
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-11-2008, 02:11 PM   #7 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

Quote:
Originally Posted by buggabill View Post
Webtuto, could you be more specific? Are you getting error messages? Are you looking to optimize the code?
What's up?
im not getting any error but in the page near "BY" it douesnt show the sender name $car[sender]
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-11-2008, 02:17 PM   #8 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

Then if you don't get the sender name give give is the code that makes $row (inc query)
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 01-11-2008, 02:20 PM   #9 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

$car not $row i edit it
but still the error
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-11-2008, 02:28 PM   #10 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

If you only need it once use:

Code:
$man=mysql_query("SELECT * FROM `coms` LIMIT 1");
$car=mysql_fetch_row($man);
   echo "By : ";
   echo"<a href='msgs.php?member=$_COOKIE[user]'>".$car['sender']."</a><br>";
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 01-11-2008, 02:32 PM   #11 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

yeah but still douesnt show any result
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-11-2008, 02:54 PM   #12 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

This stuff is pretty basic so you should know it by now. If you don't, please save it, or repeat the method a couple of times.

PHP Code:
$femaleQuery 'SELECT * FROM `coms`';
$maleQuery mysql_query($femaleQuery);

while (
$carRow mysql_fetch_array($maleQuery)) {
    
$senderName $carRow['sender'];
    echo 
'<a href="msgs.php?member='.$_COOKIE[user].'">'.$senderName.'</a><br>';

This is the way if you want to echo more than 1 result in a row, table, tr, td, div or what ever. While, Foreach and stuff prints it out, so you should use this.

I have NOT tried it out but it is the most basic method I know and very solid. The query construction aside of course.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 01-11-2008, 03:40 PM   #13 (permalink)
Jim
The Addict
 
Jim's Avatar
 
Join Date: Nov 2007
Location: the Netherlands
Posts: 281
Thanks: 2
Jim is on a distinguished road
Default

Quote:
Originally Posted by webtuto View Post
yeah but still douesnt show any result
Then you don't have a filled in "sender" field in your DB.
__________________
Nunchaku! Who doesn't like martial arts? =)
Send a message via MSN to Jim Send a message via Skype™ to Jim
Jim is offline  
Reply With Quote
Old 01-11-2008, 06:08 PM   #14 (permalink)
The Frequenter
 
ReSpawN's Avatar
 
Join Date: Nov 2007
Location: Netherlands
Posts: 460
Thanks: 49
ReSpawN is on a distinguished road
Default

OR the field isn't called sender. Use phpMyAdmin or NaviCat (or any other mySQL program) to check out how you named your database.

You can also include at the top, or rather in the config error_reporting(E_ALL); or maybe error_reporting(E_ALL ^ E_NOTICE);. This way you can see all the errors except the notices (like define and such). I use it mainly for developing since then I can see if my query is wrong, my fetch didn't go as planned or maybe if I even haven't established a connection to the database.

Good luck.
__________________
"Life is a bitch, take that bitch on a ride"
Send a message via MSN to ReSpawN
ReSpawN is offline  
Reply With Quote
Old 01-11-2008, 08:27 PM   #15 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

im gonna try night and this u the result thanks guys
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-12-2008, 06:25 AM   #16 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

it is easyer if you post what the bug output on the page is,
and in what line.
codefreek is offline  
Reply With Quote
Old 01-14-2008, 03:04 PM   #17 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

the problem is solved now thanks
__________________
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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


All times are GMT. The time now is 04:48 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design