![](https://forums.phpfreaks.com/uploads/set_resources_1/84c1e40ea0e759e3f1505eb1788ddf3c_pattern.png)
aebstract
-
Posts
1,105 -
Joined
-
Last visited
Posts posted by aebstract
-
-
andrew, you can mix text and variables in the same echo, why not?
$var1 = HI; $var2 = BYE; echo "lalala $var1 lalala $var2";
Would display - lalala HI lalala BYE
O.o
-
I'm not the world's greatest with syntax, but try replacing
echo( 'Name: ' . $row['name'] ); echo( 'Address: ' . $row['house'] ); echo( ', ' . $row['street'] ); echo( ', ' . $row['town'] ); echo( ', ' . $row['county'] ); echo( ', ' . $row['country'] ); echo( ', ' . $row['postcode'] ); echo( 'Email: ' . $row['email'] ); echo( 'Phone Number: ' . $row['phone'] ); echo( 'Mobile Number: ' . $row['mobile'] );
with
echo "Name: $row['name']"; echo "Address: $row['house']"; echo "$row['street']"; echo "$row['town']"; echo "$row['county']"; echo "$row['country']"; echo "$row['postcode']"; echo "Email: ' . $row['email'] ); echo "Phone Number: ' . $row['phone'] ); echo "Mobile Number: $row['mobile']";
If it works, you can play with it to format it how you want, not sure this is the problem 100% but see if it works.
-
Can you show more code, put it in [ code ] tags and the errors you are getting would help so we know what to look for?
-
If you don't need specific help with some sort of issue and just want someone to do this for you, this should be in the freelance section. I'm kinda puzzled as to how people come on here quite frequently, people in school and get an assignment for class but have no clue how to do their assignment? Do you not learn what you're suppose to do?
-
Got it solved, DESC is reserved and had to be surrounded by `` to work correctly.
-
Wooo, thanks for looking at the actual error
I didn't realize this issue, since it lets me pull that value from the db and all. Just haven't ran across it yet. Thanks again.
-
omg... no it doesn't. It isn't inserting anything in to my db.
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC,LOC,PRICE,SPARE)VALUES ('BPRS2-SAF-1000', 'MEYN', 'REHANGER SAFETY ARM STAT' at line 1
<?php session_start(); header("Cache-control: private"); if (isset ($_POST['submit'])) { $problem = FALSE; include "../connect/todb.php"; if (!$problem) { $pn = $_POST['pn']; $mchn = $_POST['mchn']; $desc = $_POST['desc']; $loc = $_POST['loc']; $price = $_POST['price']; $spare = $_POST['spare']; MYSQL_QUERY("INSERT INTO parts (PN,MCHN,DESC,LOC,PRICE,SPARE)". "VALUES ('$pn', '$mchn', '$desc', '$loc', '$price', '$spare')") or die (mysql_error()); header("Location: newparts.php"); } else { $content .= "$error"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>setup account</title> </head> <body> <?php $content .= '<form action="newparts.php" method="post"> <br /> PN: <br /><input type="text" maxlength="100" class="textfield" name="pn" size="40" value="' . $_POST[pn] . '" /><br /><br /> MCHN: <br /><input type="text" maxlength="100" class="textfield" name="mchn" size="40" value="' . $_POST[mchn] . '" /><br /><br /> DESC: <br /><input type="text" maxlength="100" class="textfield" name="desc" size="40" value="' . $_POST[desc] . '" /><br /><br /> LOC: <br /><input type="text" maxlength="100" class="textfield" name="loc" size="40" value="' . $_POST[loc] . '" /><br /><br /> PRICE: <br /><input type="text" maxlength="100" class="textfield" name="price" size="40" value="' . $_POST[price] . '" /><br /><br /> SPARE: <br /><input type="text" maxlength="100" class="textfield" name="spare" size="40" value="' . $_POST[spare] . '" /><br /><br /> <input type="submit" name="submit" value="submit" class="textfield" /></form>'; echo "$content"; ?> </body> </html>
-
Not producing an error nor putting anything in to the db.. can we let someone else have a chance to take a look before this topic hits 50 replies?
(already 2 unnecessary pages)
-
redarrow.. all you're doing is changing my personal settings that have nothing at all to do with the issue. The value is something I use across many scripts and just don't take out sometimes. It has NOTHING to do with this issue in any way.
-
Hmm.. I tried to echo it out but I'm just getting that error, don't know how to get around that. I took the mysql error off the end and all it does is reload the page with the values in the form fields.
redarrow: I want it to go back to the same page, so I can keep doing this over and over. There will be hundreds of parts, I don't want to take a lot of time, I would rather go back to my form and keep submitting parts.
I've tried a few different things, changing the query in terms of how I ran it and it seems to get stuck on DESC like the error says, anyone know how to get past that?
-
eh? Your questions don't make sense. With the above code, it's not entering anything to the db, it's just reloading the page now.
-
So all you did was add the real escape string? Be nice if you put at least a few words explaining your changes..
EDIT
Same error... those changes aren't aimed at the error at hand.
-
Cause this script isn't a public thing, it's just something I'm using to make life easier for myself for a short amount of time while I am doing some data entry. I know what I'm entering. The db is in the same order (not all columns are listed, but it skips through if you don't list, right?)
id
PN
TPN
MCHN
DESC
LOC
PRICE
SUB
SPARE
-
Well, you have a login script don't you? Do something with the same effect. Run the login credentials first (checking the password to the user in the db) and if it passes, then move on to check the second part (where you match the passwords).
-
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC,LOC,PRICE,SPARE)VALUES ('BPRS2-INS-1000', 'MEYN', 'INSPECTOR PUSHBUTTON STA' at line 1
<?php session_start(); header("Cache-control: private"); if (isset ($_POST['submit'])) { $problem = FALSE; if (!$problem) { $pn = $_POST['pn']; $mchn = $_POST['mchn']; $desc = $_POST['desc']; $loc = $_POST['loc']; $price = $_POST['price']; $spare = $_POST['spare']; $result = MYSQL_QUERY("INSERT INTO parts (PN,MCHN,DESC,LOC,PRICE,SPARE)". "VALUES ('$pn', '$mchn', '$desc', '$loc', '$price', '$spare')") or die (mysql_error()); header("Location: newparts.php"); } else { $content .= "$error"; } } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>setup account</title> </head> <body> <?php $content .= '<form action="newparts.php" method="post"> <br /> PN: <br /><input type="text" maxlength="100" class="textfield" name="pn" size="40" value="' . $_POST[pn] . '" /><br /><br /> MCHN: <br /><input type="text" maxlength="100" class="textfield" name="mchn" size="40" value="' . $_POST[mchn] . '" /><br /><br /> DESC: <br /><input type="text" maxlength="100" class="textfield" name="desc" size="40" value="' . $_POST[desc] . '" /><br /><br /> LOC: <br /><input type="text" maxlength="100" class="textfield" name="loc" size="40" value="' . $_POST[loc] . '" /><br /><br /> PRICE: <br /><input type="text" maxlength="100" class="textfield" name="price" size="40" value="' . $_POST[price] . '" /><br /><br /> SPARE: <br /><input type="text" maxlength="100" class="textfield" name="spare" size="40" value="' . $_POST[spare] . '" /><br /><br /> <input type="submit" name="submit" value="submit" class="textfield" /></form>'; echo "$content"; ?> </body> </html>
-
Yeah I don't understand that script 100% nor what I would need to do to group it in to doubles for each 6 digit doodad. =[
-
Yeah it locked up nicely, thats why I'm gonna do doubles and then study some more and prob. compress it down some more, but I need to know how to keep it grouped together to continue.
-
Well I actually got what I needed and did state exactly what I was needing, just didn't say what it was for. Anyhow, with this, is there an easy way to make it group in two doubles and do something such as:
aaaaaa
aaaabb
aaaacc
bbaaaa
bbaabb
etc, in doubles versus each letter individually? Of course keeping those doubles the same character.
-
Sounds like a hacking attempt to me.
Actually if you would like to not assume things, I'm gonna make a chart that displays every hex color for web use. Nice assumption though :/
edit: this is gonna be a LOT of results :/
-
Why not just pull all the results from your database that are equal to the your zip and then just add the results of the points in a loop to get them all?
-
I want to write something that will make a 6 digit number/code using a certain amount of characters, both numbers and letters. I want it to try every possible option. Could anyone help lead me in the right way of doing this?
-
setTimeout("location=$url", 3000);
?
-
I know how to match it but nevermind anyway, figured out what I had wrong.
[SOLVED] What is wrong with my code?
in PHP Coding Help
Posted
Yeah and I wasn't offering a solution (obviously) was just letting him know he can do that.