|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
Problem In PHP..
Ok i am making a tracking script to track my users go here http://www.bishopbeater.com/trackingclicks.php it says
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /mnt2/users/jonhill/jonhill/bishopbeater.com/html/trackingclicks.php on line 5 heres my code for trackingclicks.php <? mysql_pconnect("mysql.4ph.com","jonhill","changeme"); mysql_select_db("counter"); $result = mysql_query("select * from counter WHERE url=\'$url\'"); while($r=mysql_fetch_array($result)) { $id=$r["id"]; $count=$r["count"]; $url=$r["url"]; $count++; $update = "UPDATE counter SET count=\'$count\' WHERE id=$id"; $updatesql = mysql_query($update); ?> <script language="JavaScript"> document.location.href="<?php echo $url;?>" </script> <? } ?> if anyone can help me id appreciate it thanks. |
![]() |
![]() |
![]() |
#2 |
Programming till my fingers bleed.
Join Date: Aug 2003
Location: Michigan
Posts: 876
|
Is $url being set? Are there any rows in the DB that have that URL? To me it seems like there is an error causing MySQL to barf. Maybe the url column name is wrong? Can you post the db layout?
Andy |
![]() |
![]() |
![]() |
#3 |
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
|
chaldoray,
It looks like either you don't connect to your DB Server successfully, or most likely, there is an error in your query. Try this to see what the problem is: PHP Code:
![]()
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts © Top-Converting Niche Sites.</font> |
![]() |
![]() |
![]() |
#4 |
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
|
This code won't execute the script if there is an error with the SQL Query:
PHP Code:
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts © Top-Converting Niche Sites.</font> |
![]() |
![]() |
![]() |
#5 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
What's a good script to track what links your surfers are clicking any good ones out their? If so please tell me, Also what are some good sites to learn more about php function like if else, etc.
|
![]() |
![]() |
![]() |
#6 | ||
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
|
chaldoray,
Quote:
![]() Quote:
P.S. 'if' and 'else' are not functions, but language conditional statements. - some info about them can be found here: http://ca2.php.net/else Good Luck!
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts © Top-Converting Niche Sites.</font> |
||
![]() |
![]() |
![]() |
#7 |
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
|
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts © Top-Converting Niche Sites.</font> |
![]() |
![]() |
![]() |
#8 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
Thanks man im ok in php but i want to learn more about the dates and srand function and stuff, i have the book php for the worldwide web and master php 4.1
|
![]() |
![]() |
![]() |
#9 |
Trying is the first step towards failure
|
I've found these resources quite useful in the past...
http://www.phpbuilder.com/ http://www.phpfreaks.com/ Matt
__________________
Link List Land - Linklist Creation, Design and Implementation. |
![]() |
![]() |
![]() |
#10 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
Hey matt, I submitted my free sites to your site pink n purple
|
![]() |
![]() |
![]() |
#11 |
Took the hint.
|
You should always check after a query to make sure you have actual results, by:
$num_rows = mysql_num_rows ($result); You might have an issue where you are getting more than one row returned, and as a result, the fetch_array will fail because you need to fetch_row instead. Alex |
![]() |
![]() |
![]() |
#12 |
No offence Apu, but when they were handing out religions you must have been out taking a whizz
|
Good point Alex!
Another tip is to always perform your own error handling. For example: PHP Code:
![]()
__________________
Please Re-Read The Rules For Sig Files |
![]() |
![]() |
![]() |
#13 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
Can you explain all that to me? Like how would i call my host and db and check it if its in db if its not give them a error and the code to check if they submitted a form etc, how can i learn more about the mktime like 3000 i want to learn more about date and times and such thanks.
|
![]() |
![]() |
![]() |
#14 |
No offence Apu, but when they were handing out religions you must have been out taking a whizz
|
Hop over to Script School and take TDavid's 16 part (you set the pace) course on PHP. That's where I started learning PHP and now it's what I do for my living. The course if free and full of information on most if not all of the questions you have.
Then hop over to amazon.com and grab a copy of this book: PHP Functions Essential Reference by Greant, Merral, Wilson & Michlitsch; published by New Riders. It's a great reference manual and is organized a bit more logically than the php.net manuals. I've had my copy for about 6 months now and I'm probably going to have to get a new copy of it by year's end because I've used and abused it so much. ![]()
__________________
Please Re-Read The Rules For Sig Files |
![]() |
![]() |
![]() |
#15 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
Thanks man, I well go ahead and do that i already have php for the worldwide web book but it sucks is that book any good?
|
![]() |
![]() |
![]() |
#16 |
Took the hint.
|
Venturi, in the case of this code, I don't think the error is a "no result" rather too many results. fetch_array doesn't like working much when there are multiple rows in the result (need to fetch_row).
Just doing: $nums = mysql_num_rows($result); print $nums; will show how many rows are selected in the database. That would go a long way to explain what is happening after. Alex |
![]() |
![]() |
![]() |
#17 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
Anymore else i can learn? More of the functions so i can create my own scripts
|
![]() |
![]() |
![]() |
#18 |
Took the hint.
|
I have SAMS PHP in 24 hours... it is actually quite useful. Admittedly, I have been programming other languages since, well, a long f-ing time, so maybe it just makes more sense to me. I have had a couple of php books, and this is the one that stays on my desk for reference.
php.net is a good place to get info on commands and comments from end users. Alex |
![]() |
![]() |
![]() |
#19 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
I have a couple of questions, i well be using php.net for functions how can i search new function in php.net? I am going to buy another book i have mastering php 4.1 now its a ok book.
Ok now, I made a login and stuff on my page, this is how i want it whenever someone clicks a link on my page pop-ups well come up if their not a registered user so they have to sign up to look at the page then when they sign up and login then when they go to a page they don't get the pop-ups and the page well show how can i do this in php? How can you do that with .htaccess to so if your not a member on everypage you go pop-ups well come up until u register? |
![]() |
![]() |
![]() |
#20 | |
Trying is the first step towards failure
|
Quote:
php.net/fopen php.net/while That'll take you straight to the page you're looking for and it'll also list a heap of other functions in the menu. btw thanks for submitting ![]()
__________________
Link List Land - Linklist Creation, Design and Implementation. |
|
![]() |
![]() |
![]() |
#21 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
I just bought 2 php books from borders. PHP ADVANCED FOR THE WORLD WIDE WEB, and sams teach yourself php in 24 hours, BTW, i can return the books in 30 days and get a refund, so I'm going to read them in like a week then return them cool huh?
![]() |
![]() |
![]() |
![]() |
#22 |
They have the Internet on computers, now?
Join Date: Sep 2003
Posts: 142
|
What are some good marketing books i can pick up and read?
|
![]() |
![]() |
![]() |
|
|