[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 07-04-2006, 06:13 PM   #1 (permalink)
Senior Member
 
Join Date: Oct 2003
Location: Winnipeg, Canada
Posts: 3,472
5.31 NP$ (Donate)

killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold


Good project to better my php skills?

What would be a good project to better my php skills? Im new at php and finish coding a simple script at: http://www.netsnatch.com/script (which checks to see if the entered domain contains a valid license)

I dont think im ready with mysql, as most of the mysql information in the above script was copied from other scripts i bought.
killaklown is offline  
Old 07-04-2006, 07:40 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future

Autism Autism Autism Autism Autism Autism Autism
http://www.netsnatch.com/script/

Doesn't work.

MySQL basically has 3 commands (insert, select, update; the others aren't used as much) that you need to know. It isn't hard at all.
Dan is offline  
Old 07-04-2006, 07:46 PM   #3 (permalink)
Senior Member
 
Join Date: Oct 2003
Location: Winnipeg, Canada
Posts: 3,472
5.31 NP$ (Donate)

killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold


im working on making the script do more right now so it may give errors at times.

The things im not understanding right now about mysql is
mysql_query
mysql_fletch_array
etc.


Edit:

How can i get the number in a row in the database?

Code:
<?
$query = "SELECT downloads FROM counter WHERE id='1'";
$result = mysql_query($query);
$myrecord = mysql_fetch_row($result);

echo''.$myrecord.'';
?>
I have that, i want it to show the number in the 'downloads' column that has an id of 1, but all it does it show 'Array'.

Last edited by killaklown; 07-04-2006 at 07:52 PM.
killaklown is offline  
Old 07-04-2006, 08:00 PM   #4 (permalink)
NamePros Regular
 
Join Date: Dec 2005
Posts: 206
270.00 NP$ (Donate)

wackyjoe is on a distinguished road


i would use mysql_fetch_array().
wackyjoe is offline  
Old 07-04-2006, 08:31 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future

Autism Autism Autism Autism Autism Autism Autism
Use mysql_fetch_array instead of mysql_fetch_row.

I don't know why you are doing echo '', since the '' doesn't do anything.

$myrecord is an array with the row you got from the database. If you do mysql_fetch_array instead of mysql_fetch_row, you can do $myrecord['something'], where something is the name of the column in the database.
Dan is offline  
Old 07-05-2006, 09:50 AM   #6 (permalink)
Senior Member
 
Join Date: Oct 2003
Location: Winnipeg, Canada
Posts: 3,472
5.31 NP$ (Donate)

killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold


i tried using mysql_fetch_array() but it still showed array.
killaklown is offline  
Old 07-05-2006, 10:31 AM   #7 (permalink)
NamePros Regular
 
Tree's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
13.25 NP$ (Donate)

Tree will become famous soon enoughTree will become famous soon enough


You can't echo an array. Try print_r($myrecord) with mysql_fetch_array
Tree is offline  
Old 07-05-2006, 11:57 AM   #8 (permalink)
NamePros Regular
 
Flubber's Avatar
 
Join Date: Jun 2005
Location: UK
Posts: 691
25.95 NP$ (Donate)

Flubber is a splendid one to beholdFlubber is a splendid one to beholdFlubber is a splendid one to beholdFlubber is a splendid one to beholdFlubber is a splendid one to beholdFlubber is a splendid one to beholdFlubber is a splendid one to beholdFlubber is a splendid one to behold

Baby Health
PHP Code:
<?
$query
= "SELECT downloads FROM counter WHERE id='1'";
$result = mysql_query($query);
$myrecord = mysql_fetch_row($result);

echo
$myrecord['0'];
?>
Should work.

Flubb.
Flubber is offline  
Old 07-05-2006, 04:59 PM   #9 (permalink)
Senior Member
 
Join Date: Oct 2003
Location: Winnipeg, Canada
Posts: 3,472
5.31 NP$ (Donate)

killaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to beholdkillaklown is a splendid one to behold


thanks flubber, works.
killaklown is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 04:25 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85