/    Sign up×
Community /Pin to ProfileBookmark

Simple database entry

All I want to do is make a form where you can enter the name of your animal, the type of animal, and it’s age. I’m using mySQL and I have the table made up and I inserted four animals already but I don’t know how to insert the information using a form. Can I have an example of how to do this? Sorry I’m new to this ?

to post a comment
PHP

53 Comments(s)

Copy linkTweet thisAlerts:
@JonaApr 24.2004 — [font=arial]The form:[/font]

<i>
</i>&lt;form action="process.php" method="post"&gt;&lt;div&gt;
Animal: &lt;input type="text" name="animal"&gt;&lt;br&gt;
Age: &lt;input type="text" name="age"&gt;&lt;br&gt;
Name: &lt;input type="text" name="name"&gt;&lt;br&gt;
&lt;input type="submit" value="Process"&gt;


[font=arial]The PHP file (process.php in this case, but you can change the above form's action to the name of whatever you want the PHP file to be).[/font]

[code=php]
<?php

foreach($_POST as $post){
if(!isset($post)){
echo "You must fill in all fields.";
exit;
}
}

$db = mysql_connect("host", "username", "pass") or die("Could not connect to database: ". mysql_error());

mysql_select_db("database_name") or die("Could not select database: ". mysql_error());

if(!$db){echo "Unable to connect to DB: ". mysql_error(); exit;}
if(!mysql_select_db("database_name")){echo "Unable to select database: " . mysql_error(); exit;}

$query = "INSERT INTO tablename (animal,age,name) VALUES ( '". $_POST["animal"] ."', '". $_POST["age"] ."', '". $_POST["name"] ."')";

$result = mysql_query($query);

if(!$result){ echo("Mysql error: ". mysql_error()); exit; } else {
echo("Success!");
}
?>
[/code]
Copy linkTweet thisAlerts:
@HauntedauthorApr 24.2004 — Thanks ?
Copy linkTweet thisAlerts:
@JonaApr 24.2004 — [code=php]
$query = "DELETE FROM table WHERE field = 'value'";
[/code]
Copy linkTweet thisAlerts:
@HauntedauthorApr 24.2004 — How would you print the table? Just so I can stop asking you so anoying questions, do you know of any sites that show you how to change the info in database, print the info...?
Copy linkTweet thisAlerts:
@JonaApr 25.2004 — [font=arial]Check out the [url=http://mysql.com/]MySQL[/url] documentation, and [url=http://php.net/mysql]PHP.net MySQL documentation[/url].[/font]
Copy linkTweet thisAlerts:
@HauntedauthorApr 25.2004 — Thanks...again ?
Copy linkTweet thisAlerts:
@JonaApr 25.2004 — [font=arial]You're welcome. ? [/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 26.2004 — Why doesn't this work? The error I get says [i]Table 'test_db.test_table' doesn't exist[/i] which leads me to believe I need to create the table, no? I've looked through the MySQL documentation at http://php.net/ but I couldn't find anything on creating tables; only databases. I haven't a clue what I'm doing, so I'm not sure if that's even the problem. :eek: ?
[code=php]
<?php
$con = mysql_connect("localhost", "user", "pass");
if(!$con) echo mysql_error();

$sel = mysql_select_db("test_db");
if(!$sel) {
$create = mysql_create_db("test_db");
if(!$create) echo mysql_error();
}

$query = "INSERT INTO test_table (name, e-mail, age) VALUES ('Paul Junior', '[email protected]', '15')";
$result = mysql_query($query);
echo (!$result) ? mysql_error() : "DB update successful.";
?>
[/code]

The database does exist, I know that.
Copy linkTweet thisAlerts:
@JonaApr 26.2004 — [font=arial]Paul, why not use phpMyAdmin to create your tables? It's easier than manually coding it in MySQL.[/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 26.2004 — I don't know. ?

It's been recommended several times, I just never looked into it; I seem to do everything the hard way for some reason. :p

I honestly haven't a clue what phpMyAdmin is, but I'll look into it post-haste.
Copy linkTweet thisAlerts:
@JonaApr 27.2004 — [font=arial]It's a management system. Instead of using PHP to create your MySQL databases and tables, you can login and customize it with a form in phpMyAdmin. It is [b]much[/b] easier - saves hours. ?[/font]
Copy linkTweet thisAlerts:
@The_CheatApr 27.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]It's a management system. Instead of using PHP to create your MySQL databases and tables, you can login and customize it with a form in phpMyAdmin. It is [b]much[/b] easier - saves hours. ?[/font] [/B][/QUOTE]

YES! It is TONS easier.

go get the latest stable version from http://phpmyadmin.net .

if you need any help setting it up, let me know and i'll try to help. (it seems confusing at first, but the truth is you only need to edit about 5 variables in a config file to get it working properly...)

anyone who works with php+mysql must have phpmyadmin, its rediculous to not. And once you figure out how to use it, you'll kick yourself for not getting it sooner. ?
Copy linkTweet thisAlerts:
@HauntedauthorApr 27.2004 — Let's say I have a database and it contains numbers. Can I create a form where you can type in numbers and hit 'process' then have the number I typed in added to one of the numbers in the database, so if I have the number 4 in the database, I can type 3 and then update it so that the new value is 7. Sorry if this is a stupid question
Copy linkTweet thisAlerts:
@Paul_JrApr 27.2004 — [i]Originally posted by The Cheat [/i]

[B]if you need any help setting it up, let me know and i'll try to help. (it seems confusing at first, but the truth is you only need to edit about 5 variables in a config file to get it working properly...)[/B][/QUOTE]

Well I downloaded it last night, and got it all setup and working, but I only changed like... 2 variables. :p I don't know if I was supposed to, or if I did it right, but it's working now. ?

I have a question about passwords, now. What would be a secure way of storing passwords in a DB? Converting them with the md5 function, or something equivalent, and then inserting them into the DB? How would that work with password retrieval?
Copy linkTweet thisAlerts:
@JonaApr 27.2004 — [i]Originally posted by Haunted [/i]

[B]Let's say I have a database and it contains numbers. Can I create a form where you can type in numbers and hit 'process' then have the number I typed in added to one of the numbers in the database, so if I have the number 4 in the database, I can type 3 and then update it so that the new value is 7. Sorry if this is a stupid question [/B][/QUOTE]


[font=arial]Do a SELECT FROM query to get the number in the database, then add it to the formdata, then use an UPDATE query to the same field in the database with the new added values.[/font]
Copy linkTweet thisAlerts:
@JonaApr 27.2004 — [i]Originally posted by Paul Jr [/i]

[B]I have a question about passwords, now. What would be a secure way of storing passwords in a DB? Converting them with the md5 function, or something equivalent, and then inserting them into the DB? How would that work with password retrieval? [/B][/QUOTE]


[font=arial]Yes. MD5 it into the DB, then MD5 the formdata's password value to make sure they match. For example, database contains:

5d41402abc4b2a76b9719d911017c592

User inputs "hello" as their password. The form field is named "pass" and we're using the POST method in our form tag.[/font]

[code=php]
echo md5($_POST["pass"]);
[/code]


[font=arial]The result:

5d41402abc4b2a76b9719d911017c592

Are they equivalent? If so, the password ("hello") is valid, if not, the user typed an invalid password. The only drawback to this technique is that you cannot retrieve password information from the database (that I'm aware of), and it's probably a good thing, to an extent.[/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 28.2004 — Many thanks, Jona! ?

I have another question, now. I had a script like Dan's, but I've re-written it now using a MySQL database, and now I want to display the entries in a particular order. Specifically, I want the newest entries on the bottom. So every entry is appended to the botton of the existing list. I would think I'd have to retrieve then data from the database in the particular order, right? I don't really have any sort of field I can order it by, so maybe I'd just need a field that auto increments, or some such thing?

Like...
[code=php]
$query = "SELECT * FROM test_table ORDER BY auto_increment_field ASC";
[/code]

Or something like that?
Copy linkTweet thisAlerts:
@JonaApr 28.2004 — [font=arial]It makes sense that it'd work to me, although if your date field (if you have one) is in a text format, you could try to use that.[/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 28.2004 — Well, I'm not exactly sure how I'd go about creating this auto incrementing field, though. I attempted to create one, but I got all sorts of odd errors such as [i]#1075 - Incorrect table definition; There can only be one auto column and it must be defined as a key [/i].

I do have a date field, the format is "Tuesday, April 30 at 9:04 PM."
Copy linkTweet thisAlerts:
@JonaApr 28.2004 — [font=arial]Well, you could split the date field by spaces and use the one that represents the month, or you could go and add a new field in phpMyAdmin named "autoincrement," define it as a key (select the "unique" circle), and set it to auto_increment (the dropdown on the far righthand side).[/font]
Copy linkTweet thisAlerts:
@HauntedauthorApr 28.2004 — Nevermind, I fixed it ?
Copy linkTweet thisAlerts:
@Paul_JrApr 28.2004 — [b]Jona:[/b]

I think it worked! Thanks!

[b][color=red]Edit:[/color][/b]

Not... working! :mad:

I get this error: &#8220;[i]#1075 - Incorrect table definition; There can only be one auto column and it must be defined as a key.[/i]&#8221;

I set the name as [i]inc[/i], the type as [i]INT[/i] (Yes? No?), the length/values to [i]10[/i], the default value to [i]0[/i], set the extra to [i]auto_increment[/i], and checked the [i]Unique[/i] radio button. Am I missing something...?

[b][color=red]Edit 2:[/color][/b]

Okay, now it works! I had to change it from "Unique" to "Primary." I dunno why, though. Anyone know where I can find out about all this stuff? The MySQL manual/documentation is more confusing than the W3!
Copy linkTweet thisAlerts:
@JonaApr 29.2004 — [font=arial]Y'know what, Paul? I've never even looked at phpMyAdmin documentation, so I wouldn't know where to find any; I have asked a few questions (bow to the almighty Mod, pyro) about it, and the rest (as usual) I just tested different things and figured it out. So, if something doesn't work, try option B, if option B fails as well, go for option C. Thing is, you'll almost always have at least four options, and one of them will almost always work - unless, of course, it has nothing to do with your problem. ? [/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 29.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]Y'know what, Paul? I've never even looked at phpMyAdmin documentation, so I wouldn't know where to find any; I have asked a few questions (bow to the almighty Mod, pyro) about it, and the rest (as usual) I just tested different things and figured it out. So, if something doesn't work, try option B, if option B fails as well, go for option C. Thing is, you'll almost always have at least four options, and one of them will almost always work - unless, of course, it has nothing to do with your problem. ? [/font] [/B][/QUOTE]

Heheheh, all right. Thanks a lot, Jona, you've been a big help. ?
Copy linkTweet thisAlerts:
@JonaApr 29.2004 — [font=arial]No problem. ? [/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 29.2004 — Well it appears I've hijacked this thread and made it my own "Answer my questions!" thread. ?

I have a question about field types. What would be the best type for a message in a guestbook type thing? The length could be anywhere from 5 characters to 650. Right now I've chosen "longtext," but I'm not sure if I should be using something different.
Copy linkTweet thisAlerts:
@JonaApr 30.2004 — [font=arial]I'd use longtext. If it doesn't work, try option B. ? [/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 30.2004 — All right, thanks. ? That's about all the questions I have for now. ?
Copy linkTweet thisAlerts:
@Paul_JrApr 30.2004 — Okay, I was wrong; I have more questions. ?

Firstly: I need to check to see if a table in my database is empty. I'm trying to create something that'll tell a visitor when s/he last visited the page, so I need to see if the table is empty, so I can insert values as needed.

Secondly: It seems, in my guestbook script, every time I use [FONT=courier new]exit;[/FONT] all of the code from there down gets cut off; even the HTML code that's outside the PHP blocks. This is a problem since I'm serving up my page as an application of XML to those browsers that will accept it, so I get the good ol' yellow screen of death since my [FONT=courier new]</body>[/FONT] and [FONT=courier new]</html>[/FONT] tags get cut off. I have some form validation. Such as limiting the posts to one every 30 seconds. If the user is trying to post more than once every 30 seconds, I echo out a message and exit the script so the values aren't inserted into the DB. Except it seems that the [FONT=courier new]exit;[/FONT] statement is not only exiting the script, but cutting off the end of my page. I've even tried adding the ending tags into my message, which gets displayed, but that doesn't even work. ?
Copy linkTweet thisAlerts:
@JonaApr 30.2004 — [font=arial]Include your footer files first, then exit. I usually use an exit function of my own...[/font]

[code=php]
function errMsg($msg) {
echo $msg;
include ("footer.php");
exit;
}
[/code]


[font=arial]Also, you should just overwrite a field to determine when someone last visited.[/font]
Copy linkTweet thisAlerts:
@Paul_JrApr 30.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]Include your footer files first, then exit. I usually use an exit function of my own...[/font]



[code=php]
function errMsg($msg) {
echo $msg;
include ("footer.php");
exit;
}
[/code]
[/B][/QUOTE]

I'm not sure I follow; I don't actually have any files to include. I can show you the page/give you code/explain the system if you need more information.

[i]Originally posted by Jona [/i]

[B][font=arial]Also, you should just overwrite a field to determine when someone last visited.[/font] [/B][/QUOTE]

Yes, but as I see it, I first need to check if the table is empty -- which would mean no one has visited the page, would I could solve by just sticking my own information in there -- then I need to check to see if the "ip" field matches the current IP, and if it does, I just need to update the "ip" field so the timestamp updates.

Not sure if I have it right there, but I thought all this up last night at around 2 A.M. 'cause I couldn't sleep. :p
Copy linkTweet thisAlerts:
@JonaApr 30.2004 — [font=arial]Why check if it's empty? If it is empty, then it won't be equal to the current IP address, now will it?

You can also just echo out the end of the page before you exit, if you're not using includes (which probably isn't a great idea).[/font]

[code=php]
echo("</body></html>"); exit;
[/code]
Copy linkTweet thisAlerts:
@Paul_JrApr 30.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]Why check if it's empty? If it is empty, then it won't be equal to the current IP address, now will it?

[/B]
[/QUOTE]

That is true. :o

I still seem to be having trouble with it, but I think I'm going to give it a rest now, since I seem to be getting ahead of myself here. ?

[i]Originally posted by Jona [/i]

[B]You can also just echo out the end of the page before you exit, if you're not using includes (which probably isn't a great idea).[/font]



[code=php]
echo("</body></html>"); exit;
[/code]
[/B][/QUOTE]

Well... I don't know why, but now it works. ?

This:
[code=php]
exit("<p>You cannot post more than once every 30 seconds.</p>n</body>n</html>");
[/code]

Became this:
[code=php]
echo "<p>You cannot post more than once every 30 seconds.</p>n";
echo "</body>n</html>";
exit;
[/code]


[b][color=red]Edit:[/color][/b]

I did get it to work, but the date that I'm inserting is created with the [FONT=courier new]date();[/FONT] function, which I don't want. I want to use timestamps, because later, when I get better at this, I want to be able to compare times so the time doesn't update every time you refresh the page.
Copy linkTweet thisAlerts:
@JonaMay 01.2004 — [i]Originally posted by Paul Jr [/i]

[B][color=red]Edit:[/color]

I did get it to work, but the date that I'm inserting is created with the [FONT=courier new]date();[/FONT] function, which I don't want. I want to use timestamps, because later, when I get better at this, I want to be able to compare times so the time doesn't update every time you refresh the page. [/B]
[/QUOTE]


[font=arial]You mean UNIX timestamps (the [/font][font=monospace][url=http://php.net/time]time()[/url][/font][font=arial] function)? You can use [/font][font=monospace]time()[/font][font=arial] and record that in the database, and then use [/font][font=monospace]date("FORMAT", $timestamp)[/font][font=arial] to process it. See [/font][font=monospace][url=http://php.net/date]date()[/url][/font][font=arial].[/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 01.2004 — Greetings,

I have a table that contains links, along with some other information. There is a category field, a URL field, a name field, and description field, and an auto-incrementing ID field.

Currently, I display the pre-inserted rows onto a page within a table. I have radio buttons in each row of the table so I can delete that particular row in the table. The only problem is that the rows keep their respective ID numbers, I want to reset the numbers. If I delete the first row in the table, I want all the ID numbers to reset -- each ID drops down one number. Is this possible?

I can post the code if you need it.
Copy linkTweet thisAlerts:
@JonaMay 01.2004 — [font=arial]No, it doesn't automatically decrement when a field is dropped; you'd have to run some kind of script to completely reset all the ID's for each field that exists - more work than it's worth. Why would you need to do this, anyway? The data would still be there, so links will never be broken, unless it is a link to an ID which has been removed.[/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 01.2004 — Well, because the table could end up looking funny, and I'd like to keep the IDs all normal and correctly numbered, in the case of future editing/manipulating of the rows via their ID, which is most convenient. I suppose it's not [i]really[/i] necessary, but I'd like to be able to do it if I could.
Copy linkTweet thisAlerts:
@JonaMay 01.2004 — [font=arial]You can, but I'm not going to do it for you. ? [/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 01.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]You can, but I'm not going to do it for you. ? [/font] [/B][/QUOTE]

Oh, you're bad, oh so bad. :p

The table looks like this (screenshot).

[upl-file uuid=f203c05b-d287-4301-84c7-8409014d3614 size=24kB]screenshot.png[/upl-file]
Copy linkTweet thisAlerts:
@JonaMay 01.2004 — [font=arial]I kind of guessed what it looked like... :p [/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 01.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]I kind of guessed what it looked like... :p [/font] [/B][/QUOTE]

Oh, you're good -- you're bad, but you're good. ?

Now it's kinda changed... now the ID cell only contains the ID number, and I added a cell to the end containing just a radio button for deleting the row.
Copy linkTweet thisAlerts:
@JonaMay 01.2004 — [i]Originally posted by Paul Jr [/i]

[B]Now it's kinda changed... now the ID cell only contains the ID number, and I added a cell to the end containing just a radio button for deleting the row. [/B][/QUOTE]


[font=arial]And I need to know this, because...? It will help to keep me intellectually balanced while I spray mosquitos in my grandmother's back yard? It will prevent any in-grown toenails for the next year? It will make my future wife become beautiful?[/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 01.2004 — [i]Originally posted by Jona [/i]

[B][font=arial]And I need to know this, because...? It will help to keep me intellectually balanced while I spray mosquitos in my grandmother's back yard? It will prevent any in-grown toenails for the next year? It will make my future wife become beautiful?[/font] [/B][/QUOTE]

Honestly? I have absolutely no idea.

But since you're going to be SOOOOOO mean and not tell me! :p I'm going to go on with the other feature I was going to add (being able to add links to the table).

I'll let you know about every minuscule and minute change.
Copy linkTweet thisAlerts:
@Paul_JrMay 02.2004 — Well, here I am. ?

I have been looking at this forever and I cannot seem to figure out why it won't work... ?

This is the relevant source of the page:
[code=php]
<?php
mysql_connect("localhost", "user", "pass");
mysql_select_db("test_db");
$query = mysql_query("SELECT * FROM test ORDER BY id");
if((!isset($_GET["action"])) || ($_GET["action"] != "delete") || ($_GET["action"] != "update")) { ?>
<h1>Links list</h1>
<form action="index.php?action=process" method="post">
<div>
<table>
<thead><tr><th>Category</th><th>Name</th><th><abbr title="Uniform Resource Locator">URL</abbr></th><th>Description</th><th>ID</th><th>Delete</th></tr></thead>
<tbody>
<?php
while($rows = mysql_fetch_array($query)) {
echo "<tr><td>" . ucfirst($rows["cat"]) . "</td><td>" . $rows["name"] . "</td><td><a href="" . $rows["url"] . "">" . $rows["url"] . "</a></td><td>" . $rows["desc"] . "</td><td>" . $rows["id"] . "</td><td><input type="radio" name="delete" value="" . $rows["id"] . "" /></td></tr>n";
} ?>
</tbody></table>
<div style="text-align: right; margin-top: 0.5em;"><input type="submit" name="submit_d" id="submit_d" value="Delete Row" /></div>
</div>
</form>
<form action="index.php?action=update" method="post">
<div>
<h2>Add Link</h2>
<div><label for="cat">Category:</label>
<input type="text" name="cat" id="cat" maxlength="10" /></div>
<div><label for="url">URL:</label>
<input type="text" name="url" id="url" maxlength="40" /></div>
<div><label for="name">Name:</label>
<input type="text" name="name" id="name" maxlength="35" /></div>
<div><label for="desc">Description:</label>
<input type="text" name="desc" id="desc" maxlength="100" /></div>
<input type="submit" name="update" id="update" value="Update Table" />
</div>
</form>
<?php
}
elseif($_GET["action"] == "delete") {
mysql_query("DELETE FROM test WHERE id = '" . $_POST["delete"] . "'");
header("location: index.php");
}
elseif($_GET["action"] == "update") {
$cat = htmlspecialchars(strip_tags(trim($_POST["cat"])), ENT_QUOTES);
$url = htmlspecialchars(strip_tags(trim($_POST["url"])), ENT_QUOTES);
$name = htmlspecialchars(strip_tags(trim($_POST["name"])), ENT_QUOTES);
$desc = htmlspecialchars(strip_tags(trim($_POST["desc"])), ENT_QUOTES);
/*if(empty($cat) || empty($url) || empty($name) || empty($desc)) {
header("location: index.php");
exit;
}*/
mysql_query("INSERT INTO test (cat, url, name, desc) VALUES ('" . $cat . "', '" . $url . "', '" . $name . "', '" . $desc . "')");
header("location: index.php");
}
?>
[/code]

From [FONT=courier new]<body>[/FONT] to [FONT=courier new]</body>[/FONT].

I get no errors... no nothing. The DB isn't being updated, and I can't even delete rows... ?
Copy linkTweet thisAlerts:
@JonaMay 02.2004 — [font=arial]You should be using && not || (and not or) in your first if statement.[/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 02.2004 — Wow. *Hangs his head in shame* :o

Thanks once again. ?
Copy linkTweet thisAlerts:
@JonaMay 02.2004 — [font=arial]lol. You're welcome. ? [/font]
Copy linkTweet thisAlerts:
@Paul_JrMay 02.2004 — Well, thanks to you Jona, everything is working out just peachy-keen. ?

But, the wheels in my crafty li'l mind have been turning, and I think I know how I can reset that auto_incrementing ID. :p

When I do my INSERT query, to update the table, I just have to drop the auto_inc field, then re-add it! It should be as I want it then -- I mean, it is when I do that in phpMyAdmin. ?

[b][color=red]Edit:[/color][/b]

Wooo! And you said it's more trouble than it's worth... it's just two extra lines! ?
Copy linkTweet thisAlerts:
@The_CheatMay 02.2004 — i personally prefer using AND and OR in my if statements over using && and ||. I think reading AND and OR makes more sense, especially since my editor's syntax highlighting makes them a diff color and bold. Just my personal prefs ?
Copy linkTweet thisAlerts:
@Paul_JrMay 02.2004 — [i]Originally posted by The Cheat [/i]

[B]i personally prefer using AND and OR in my if statements over using && and ||. I think reading AND and OR makes more sense, especially since my editor's syntax highlighting makes them a diff color and bold. Just my personal prefs ? [/B][/QUOTE]

Well, I started out with JS, and there's only && and ||, so I've gotten used to it. Also, AND and OR have lower precendence than && and || I think -- although I'm not sure that makes any sort of a difference.

But, I have a question about what I did to get the ID field to reset. Is it efficient/inefficient to drop, then add, a field to my table each time I delete a row, or add a row?
Copy linkTweet thisAlerts:
@The_CheatMay 02.2004 — you can change the auto_increment by selecting your table in phpmyadmin, then clicking on the operations tab, then scroll to the bottom and you will see it as the last option.

so basicly, the easy way would be to execute what you are going to want your script to do through phpmyadmin, then once you've executed it, at the top it will tell you the code it used to execute it, then click "create php code" and then copy it into your php script where desired. Get it?
Copy linkTweet thisAlerts:
@Paul_JrMay 02.2004 — [i]Originally posted by The Cheat [/i]

[B]so basicly, the easy way would be to execute what you are going to want your script to do through phpmyadmin, then once you've executed it, at the top it will tell you the code it used to execute it, then click "create php code" and then copy it into your php script where desired. Get it? [/B][/QUOTE]

That's just about what I did. ?
Copy linkTweet thisAlerts:
@JonaMay 02.2004 — [i]Originally posted by The Cheat [/i]

[B]i personally prefer using AND and OR in my if statements over using && and ||. I think reading AND and OR makes more sense, especially since my editor's syntax highlighting makes them a diff color and bold. Just my personal prefs ? [/B][/QUOTE]


[font=arial]On [url=http://dr2.net/]some hosts[/url], which I won't name, the HTML editor (not WYSI[N]WYG editor) converts ampersands (&'s) into &amp;amp;'s -- the entity value. Why, I have no clue, but it also tends to automatically convert any other entity values into their actual entities (for example, &amp;copy; becomes &copy; in the actual HTML code). That's more of problem with the control panel system, but using AND or OR is better for portability. That's an experience, not a preference. ? I actually prefer to use && or ||, myself. ? [/font]
×

Success!

Help @Haunted spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...