-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
Look up :D
-
bump thing
-
Basically making the items show, I'm stuck on how to do it. (I know I could do a while statement).
Well more in less, actually get it to restock
[code=php:0]if($time = $row[time]){
//restock it
}else {
die();
}
[/code] -
I am making a game with some people and we are stuck on how we would do a restock system.
Our only idea was to run a cron every 1 minute and if the set number in the database equaled the one in the cron then it would run.
Also, with the items, I were thinking of an array rand.
Have an array with like 1 = item number 1, 5 = item#5 etc...
And have a random number between 10 and 20 and then have it insert into the database. If somebody bought the item then it would take it remove it from the database. Is this all anywheres possible? -
[code]
if(isset($_POST['submit'])) {
if(!isset($_POST['search'])) {
header("Location: ?page=forum&sub=search");
die();
}else {
$searchterm = $_POST['search'];
$query = mysql_query("SELECT * FROM `forum_threads` WHERE `text` LIKE %$searchterm%");
while($search = mysql_fetch_object($query)) {
echo $search->id;
}
mysql_free_result($query)
}
} else {
echo "<form method=\"POST\" action=\"?page=forum&sub=search\">";
echo "<input type=\"text\" name=\"search\" id=\"search\">";
echo "<input type=\"submit\" name=\"submit\" id=\"submit\">";
echo "</form>";
}
[/code] -
Or, how could I do this. Have a drop down using a while statement and have it so that the ID given is the selected one?
-
How would I use it in relationship to a SQL database?
-
They could be using a mySQL database or just files.
Basically if they used a mysql database it would be something like:
[code]
$id = $_GET['id'];
$cat = $_GET['cat'];
if(!isset($id)){
$id = 1;
}
if(!isset($cat)){
$cat = 1;
}
$sql = "SELECT * FROM `pages` WHERE `pageid` =$id AND `cat` =$cat";
$res = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($res);
echo "page title: $row[title]<br>author: $row[author]<br><br>\n";
echo "contents: $row[pagecontents]";
[/code]
-
I am making a forum and I was wondering, the user selects say board ID #5 and want the post to go onto board #5, but he meant six, without changing the URL he could use a drop down to find the one he wants, but sort by id 1-12 but 5 being first.
So the drop would be like:
5- ONTOP
1
2
3
4
6
6
7
8
9
10
11
12 -
Nope :/
-
You reached a certain post amount.
-
That's what I have. Still isn't working.
-
You should just use a database so you don't have to go haywire in having to have php write to files
-
Log in and go to:
http://atara.org/games/slots.php -
ataria.org/login.php
-
TEST ACCOUNT:
username: test
password: test
feel free to look through, and yes, i'm helping with this game -
Use a VNC :D
-
Obviously it won't work now, it's only 18:36 GMT
-
I am making a user registration and it just checks to see if all the fields are filled in. But if they aren't then the file would echo off an error.
[code]
<?php include('header.php'); ?>
<?php
$act = $_POST[act];
if(!isset($act)){
echo "<table border=0 cellspacing=3 cellpadding=2>\n";
echo "<form name=reg method=post action='".$_SERVER[PHP_SELF]."'>\n";
echo "<tr><td class=gbr>Username:<td class=gbr><input type=text name=username>\n";
echo "<tr><td class=gbr>Password:<td class=gbr><input type=password name=pass>\n";
echo "<tr><td class=gbr>Confirm:<td class=gbr><input type=passowrd name=pass2>\n";
echo "<tr><td class=gbr>Email:<td class=gbr><input type=text name=email>\n";
echo "<tr><td class=gbr>Confirm:<td class=gbr><input type=text name=email2>\n";
echo "<tr><td class=gbr>Birthday:<td class=gbr>
<select name=month>
<option value=January>January
<option value=February>February
<option value=March>March
<option value=April>April
<option value=May>May
<option value=June>June
<option value=July>July
<option value=August>August
<option value=September>September
<option value=October>October
<option value=November>November
<option value=December>December
</select>\n<select name=day>\n";
for($i=1; $i<32; $i++){
echo "<option value=$i>$i</option>\n";
};
echo "</select>\n";
echo "<select name=year>\n";
for($i=1900; $i<1994; $i++){
echo "<option value=$i>$i</option>\n";
};
echo "</select>\n";
echo "<tr><td colspan=2><input type=submit value='".Register."'> <input type=reset value='".Reset."'>\n";
echo "<input type=hidden name=act value=register>\n";
echo "</form></table>\n";
}
if($act == register){
$username = $_POST[username];
$pass = $_POST[pass];
$pass2 = $_POST[pass2];
$email = $_POST[email];
$email2 = $_POST[email2];
$month = $_POST[month];
$day = $_POST[day];
$year = $_POST[year];
if(isset($username) && isset($pass) && isset($pass2) && isset($email) && isset($email2)){
if($pass != $pass2){
echo "<b>Your confirmation password is not the same as your password!</b><br>";
}
if($email != $email2){
echo "<b>Your confirmation email is no the same as your email!</b><br>";
}
}else {
echo "Please fill in all the fiedls!";
}
}
?>
<?php include('footer.php'); ?>
[/code] -
You can try:
[code=php:0]
$username = $_POST['username'];
$password = $_POST['password']; //or md5($_POST['password']) whichever you're using
if(isset($username) && isset($password)){
$cookie1 = setcookie("name","value","time");
$cookie2 = setcookie("name","value","time");
//etc...
if($cookie1 && $cookie2){
//log in using cookies
}else {
$_SESSION['sess1'] = sess1;
$_SESSION['sess2'] = sess2;
}
}
[/code] -
What are $likelihood and $status and stuff equaling?
-
You have a SQL query on like line 2-3 of your original coding.
You are selecting something from like `"$table_name" . "somethinghere"`
That line, add it there. -
") or die(mysql_error());
You add that on the end of the query. -
You have an error in your query
SELECT * FROM `tablename`
Just do that. `$tablename.whateveryouhadhere`
Then when you end the query do: ") or die(mysql_error());
[SOLVED] Moved site to new server, script is broken
in PHP Coding Help
Posted