Can someon help with my script?

please read the php manual about arrays. this is very important for using php.
http://www.php.net/manual/en/language.types.array.php

and try to look up evey function/control-structure u are using.
http://www.php.net/manual/en/control-st … oreach.php

u still use the loop to output all values. but in every loop u output the key. thats why the key is outputted as offen as u have fields in ur table.

cange:
[php]foreach ($line as $col_value)
echo $line[‘key’];
{
}[/php]
to:
[php]echo $line[‘key’];[/php]

That fixed that end of it! I have one more question, and then I think I will have all the bases covered in SQL (at least the ones I will need to cover) Is there a correct way to do this

[php]
$insert = “INSERT INTO users $line[‘verify’]
VALUES (’”.$verified."’)";
$add_member = mysql_query($insert) or die(mysql_error());
[/php]

Im trying to insert the varible $verified into the same line as I am working with. Im sure its probably a syntax problem or I am taking the wrong approach The whole code is below should it be needed
[php]

<?php define(NULL_KEY,"00000000-0000-0000-0000-000000000000"); $verified = "1"; $data = $_GET['data'];//gets the info after data= in the url and declares it $data $key = file_get_contents('http://w-hat.com/name2key/?terse=1&name=' .urlencode( $data)); $link = mysql_connect("localhost", "bizcards_admin", "dbase75454") or die('Could not connect: ' . mysql_error()); mysql_select_db("bizcards_database") or die('Could not select database'); $query = "SELECT * FROM users WHERE username = '".$data."'" or die(mysql_error()); $result = mysql_query($query) or die('Query failed: ' . mysql_error()); //find $data in the username section of the database, becuase it is a name if not found return error //if found get the key from the same line, if the key matches $key write a 1 to the verify of the same line if (!$result) { echo "You have not registered this name with us"; } if($key == NULL_KEY) { echo "Your name is not in the database Please contact Draco Kamachi"; } while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($line['key'] != $key) { echo "NO MATCH"; //Ths is not possible } if ($line['key'] == $key) { $insert = "INSERT INTO users $line['verify'] VALUES ('".$verified."')"; $add_member = mysql_query($insert) or die(mysql_error()); echo "Account Verified"; } } mysql_free_result($result); mysql_close($link); ?>

[/php]

[php]$insert = ‘UPDATE users SET verified=1 WHERE username="’.mysql_escape_string($data).’"’;[/php]

I think I should set my signature to Wem Syntax verwechselt, k?nnen Entdeckungen es froh halten. (dont know the word for syntax) That fixed all my sql errors, I just need to figues out the final error and Ill be done with the thing. syntax error, unexpected ‘"’ in so I should just remove some " and itll work. Thanks for all your help on this!

Fixed the syntax now it returns
Call to undefined function: values() in verife.php on line 32

u removed the wrong one.

the quotes have to be balanced. try counting the single an double quotes. both has to be a even number.

origional line
[php]
VALUES (’".$verified."’)";
[/php]

The line after I removed one
[php]
VALUES (’".$verified."’);
[/php]

there balanced but I will try every one and see
And sorry for my bad greman es should have been sie :slight_smile:[/i]

if u realy wanna know it:
Wem Syntax verwechselt, k?nnen Entdeckungen es froh halten

wem is whom. has to be wer.
syntax is 100% right, same word an of cause with a capital letter.
verwechseln means mix up.
k?nnen is plural, but with wer it has to be singular.
Endekungen is the subject of this sentence and means discoveries.
es like u mentiont is sie.
froh means happy.
and halten is hold, behalten is keep.

if i would translate that back to english it would result in:
whom mixes up syntax, may discoveries hold it happy.

sorry, but that german sentence was exactly as confusion as this translation.

Cool, I was never good at german, I just knew enough to use the hacking programs they made :slight_smile: I have tried every possible combination of " I can think of, could the problem be something else?
[php]

<?php define(NULL_KEY,"00000000-0000-0000-0000-000000000000"); $verified = "1"; $data = $_GET['data'];//gets the info after data= in the url and declares it $data $key = file_get_contents('http://w-hat.com/name2key/?terse=1&name=' .urlencode( $data)); $link = mysql_connect("localhost", "ghtyrre_admin", "dbase") or die('Could not connect: ' . mysql_error()); mysql_select_db("bizcards_database") or die('Could not select database'); $query = "SELECT * FROM users WHERE username = '".$data."'" or die(mysql_error()); $result = mysql_query($query) or die('Query failed: ' . mysql_error()); //find $data in the username section of the database, becuase it is a name if not found return error //if found get the key from the same line, if the key matches $key write a 1 to the verify of the same line if (!$result) { echo "You have not registered this name with us"; } if($key == NULL_KEY) { echo "Your name is not in the database Please contact Draco Kamachi"; } while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { if ($line['key'] != $key) { echo "NO MATCH"; //how can this happen } if ($line['key'] == $key) { echo "Account Verified"; $insert = 'UPDATE `users` SET `verified`=1 WHERE `username`="'.mysql_escape_string($data).'"'; VALUES ('".$verified."'); $add_member = mysql_query($insert) or die(mysql_error()); } } mysql_free_result($result); mysql_close($link); ?>

[/php]

Here is the exact output less the file location including echos

Account Verified
Fatal error: Call to undefined function: values() in – on line 32

just delete this line:
[php]VALUES (’".$verified."’); [/php]

P.S.: plz put some blanks in the line 41affc6-98dc-4cbc-bddd-8fdc3869906a241affc6… (to avoid horizontal scrolling)

A+ Works flawlessly! I cant thank you enough!!! Thanks!!!

Sponsor our Newsletter | Privacy Policy | Terms of Service