Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-20-2005, 04:47 AM   #1
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Quick PHP Question

I am using the following:

[CODE]$sqlquery = "UPDATE `table` SET `name` = '$name' WHERE `id` = 'id1'";
$results = mysql_query($sqlquery);/CODE]

However, this only seems to be working for the ID that is 4 numerical characters long and not the ID that is 20 characters long with both numerical and alphabetical characters .

Anyway to make this work with both?
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 04:52 AM   #2
ilbb
Confirmed User
 
ilbb's Avatar
 
Industry Role:
Join Date: May 2005
Location: EU - Czech republic
Posts: 3,025
Use quotes exactly:
$name = name
$id = id of row in table

$sqlquery = "UPDATE `table` SET `name` = '".$name."' WHERE `id` = '".$id."'";

What data types do You have in Your sql table?
ilbb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 04:53 AM   #3
ilbb
Confirmed User
 
ilbb's Avatar
 
Industry Role:
Join Date: May 2005
Location: EU - Czech republic
Posts: 3,025
and Yes, If You want to work with 20chars id's check atrib ID datatypes:

varchar (20) for alphabetical
int (20) for numeric only
ilbb is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 04:56 AM   #4
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
ID = VARCHAR 20. It is also the Key. The script already pulls the ID from the url and when I echo ID1 on the page its correct
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 04:58 AM   #5
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Sorry - SET `name` = '55' name is already set in the script itself
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 05:05 AM   #6
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
varchar (20) for alphabetical
int (20) for numeric only

What should I use for both? It looks something like this 907fasd90f78aha
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 06:16 AM   #7
GFX Wiz
Confirmed User
 
Join Date: Jul 2004
Location: SW Florida
Posts: 916
Quote:
Originally Posted by mkx
varchar (20) for alphabetical
int (20) for numeric only

What should I use for both? It looks something like this 907fasd90f78aha
char (20)
__________________
ICQ: 148.167.599
GFX Wiz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 03:06 PM   #8
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
still not working. sorry for the newb question but does anyone know how to just insert an increasing number into the ID table instead? Starting at 1. so each time a new entry is inserted, a new increasing id is created, 1, 2, 3 ., etc. I cant find my php for dummies book
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 03:10 PM   #9
Sam Granger
Confirmed User
 
Sam Granger's Avatar
 
Join Date: Dec 2004
Location: NL (Eindhoven), CZ(Prague), FR(Concarneau)
Posts: 3,958
in phpmyadmin next to the attribute tick the auto_increment
__________________
[img]http://****************/sig/fhv3_j2_624x80_2.gif[/img]
$35-40 Per Signup, 60-70% Rev Share, over 80 Sites, Exclusive Sites, tons of free content
14,000+ Free hosted Galleries, RSS feeds, Domain Hosting, Embedded Flash Movies
Join Fetish Hits now!
ICQ: 358652230
Sam Granger is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 03:11 PM   #10
Sam Granger
Confirmed User
 
Sam Granger's Avatar
 
Join Date: Dec 2004
Location: NL (Eindhoven), CZ(Prague), FR(Concarneau)
Posts: 3,958
or just put auto_increment in your sql
__________________
[img]http://****************/sig/fhv3_j2_624x80_2.gif[/img]
$35-40 Per Signup, 60-70% Rev Share, over 80 Sites, Exclusive Sites, tons of free content
14,000+ Free hosted Galleries, RSS feeds, Domain Hosting, Embedded Flash Movies
Join Fetish Hits now!
ICQ: 358652230
Sam Granger is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 03:31 PM   #11
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Ok thanks, so how would I retype this line:

$sqlquery = "INSERT INTO $table VALUES('$txn_id','next........

Where I want to replace $txn_id with an auto increment number
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2005, 04:30 PM   #12
Phoenix66
Confirmed User
 
Join Date: Oct 2002
Posts: 823
Just omit the autoincrement field from your query, it will be generated automatically when you insert other fields.

Use mysql_insert_id() to obtain the value of that field right after the insert query, if you need it...
__________________
Adult Niche Traffic Exchange
Phoenix66 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-21-2005, 05:29 AM   #13
mkx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Toronto
Posts: 4,001
Got it working, thanks!
mkx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.