|
Web design and Programming Discuss website creation and other programming topics. |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||
|
Sql
Hey, what's wrong with this? It won't input the values!
PHP Code:
__________________
|
#2
|
||
|
Ha! Ye Beggers I found out how to select certain columns I hope it is kinda the same as the rows......
PHP Code:
__________________
|
#3
|
||
|
NM it still is not working.
This is what I am using: PHP Code:
__________________
|
#4
|
||
|
is any error message being displayed?
IcI |
#5
|
||
|
Negative.
I even put this on the end: PHP Code:
__________________
|
#6
|
||
|
how many fields are there in the table?
You may want to read through this and see if any thing would apply to help out: http://dev.mysql.com/doc/mysql/en/insert.html Also, if you want to select specific columns from do SELECT field1, field2 FROM table_name To limit it to a specific row (such as a particulare user): //Assume $userID = 100 SELECT username, userpassword FROM user_table WHERE user_ID ='$userID' That will provide the username and password for the user who's id is 100 IcI |
#7
|
||
|
hmm i run into this some times...copy what PHP MY ADMIN does when your doing it, and put in some of those post variables or whatever
|
#8
|
||
|
It is workin' fine now, I was told I need to use replace with " and '. Is there another character that I need to replace? I should make an array or function out of it
__________________
|
#9
|
||
|
BTw that is right. The first variable is SID so I can use that as refrence I guess...time to get the exporting part done. Then I can start adding html and stuff to the fields...this tutorial script is going to rock.
__________________
|
#10
|
||
|
It doesn't have to be the first variable. You can use any field.
And you can even be more selective using more WHERE clauses, using AND or OR: Select * from user_table WHERE is_admin = '1' AND WHERE password = '$password' IcI |
#11
|
||
|
Yeah but if password has ' in it then it would be password = ' ' ' which would screw it up. That is why I need to use the replace command. I guess you can do the same thing with html stuff if you want to disable html.
__________________
Last edited by atholon; 05-28-2005 at 09:37 AM. |
#12
|
||
|
you should only use WHERE once, AND WHERE could confuse with bigger querys.. like
SELECT * FROM tbl_name WHERE user='user' AND password='password' AND (email='email' OR phone='phone')"); using a bracket will group it together, so either one has to be true, hence the OR.
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#13
|
||
|
Cool
__________________
|
#14
|
||
|
and for you user=' ' ' problem..
INSERT INTO tbl_name VALUES ('".addslashes($data)."','".addslashes($data2)." ')
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#15
|
||
|
if you get sick of typing addslashes all the time.. make a function...
function as($key) { return addslashes($key); } then use as($data) .. I do this for stripslashes and htmlspecialchars.. so comminly used but there so long to type out.. I use function slash($key) { $key=stripslashes($key); return stripslashes($key); } function html($key) { $key=htmlspecialchars($key); return slash($key); //for output }
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#16
|
||
|
you can save alot of time by writing functions ath.. like or mysql_query() or die ("theres an error yada yada".mysql_error());
function my_error() { $key="theres an error yada yada".mysql_error(); return $key; } now it's just mysql_query() or die(my_error()); I write alot of functions just to shorten the name of a long function.. like number_format() would be nf() etc etc.
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#17
|
||
|
I am looking at SS site trying to use the select query and it aint working.
PHP Code:
__________________
|
#18
|
|||
|
I get this:
Quote:
__________________
|
#19
|
||
|
well theres nothing wrong there so it's either the name of your table or id..
__________________
04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq |
#20
|
||
|
I'll take a screen of it from phpmyadmin
__________________
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
SQL Query causing blank page | .Simon. | Web design and Programming | 3 | 11-05-2010 05:20 AM |
Book recommendation for ASP.NET 2.0 and SQL Server | DevilDog#1 | Web design and Programming | 0 | 01-05-2007 07:12 PM |