HuggieBear
Members-
Posts
1,899 -
Joined
-
Last visited
Everything posted by HuggieBear
-
First you need to find out if the .cgi will allow you to submit from wherever you are? Some only allow certain referrer URL's. Assuming it does, I'd say you need a JavaScript action after you've processed the PHP to submit a hidden form. Only way I can think to do it. Regards Huggie
-
You should be able to use [url=http://uk.php.net/manual/en/function.explode.php]explode()[/url] for that. [code] <?php $array = explode("\n", $_GET['name_textarea']); ?> [/code] Regards Huggie
-
I think you can do an array compare against two arrays, that would probably be the way to go... Look at [url=http://uk.php.net/manual/en/function.array-diff.php]array_diff()[/url]. Get both sets of data into an array, this should be pretty simple, if you're not sure, give us a shout back. Regards Huggie
-
Odd, as the same image says showing rows 0 to 0 Hmmmm, Interesting! If you want to provide a sql dump of the table I'll load it into my version of phpMyAdmin and see if I get the same results. Regards Huggie
-
In that case give $result a shorter name too, like $c for say columns... [code=php:0] $sql = "SELECT * FROM table WHERE id = 1"; $c = mysql_fetch_row($sql); echo "$c[0] $c[1] $c[2]"; [/code] Regards Huggie
-
What's the problem? Regards Huggie
-
You can use mysql_fetch_row() but this will still give you an array of numbered columns. [code=php:0]$sql = "SELECT * FROM table WHERE id = 1"; $result = mysql_fetch_row($sql); echo "$result[0] $result[1] $result[2]"; [/code] Regards Huggie
-
Jester, Try to use [b][[/b][b]code][/b] [b][/[/b][b]code][/b] tags when posting your code. Give this a try... [code] <?php if(!IsSet($indexloaded)){ header("Location: ./index.php"); } $checkaccess=mysql_query("SELECT * FROM staff1 WHERE id='$admn[id]'"); $ca=mysql_fetch_array($checkaccess); if((!$ca[gmode]) AND (!$ca[mastera])){ if(!$ca[eteam]){ include("$dir[func]/error.php"); display_error("You are not allowed to Edit Teams."); } } /* //CHECK ADMIN ACCESS LEVEL if($admn[access] < 15){ include("$dir[func]/error.php"); display_error("You are not allowed to perform this function."); } */ if (isset($_GET['submit'])){ $sql = "UPDATE ladder_7 SET status = 20 WHERE rank <= 16"; $result = mysql_query($sql) or die ("Cannot execute $sql: " . mysql_error()); if ($result == true){ echo "Top 16 successfully locked"; } else { echo "Error while locking top 16"; } } $tablehead=table_head("show","700","","left"); $tablefoot=table_foot("show"); $out[body] .= <<<HTML <center> {$tablehead} <center><strong><font color="{$style[headerfont]}">Lock top 16</font></strong></center> <hr color="{$style[headerfont]}" size="1"> This will lock all the top 16 for Rouge Spear Only. Used only for tournaments. Any other use will result in termination. <center> <form name="update" method="GET" action="{$_SERVER['PHP_SELF']}"> <input type="submit" name="submit" value="Lock top 16"> </form> </center> {$tablefoot} HTML; include("$dir[curtheme]"); ?>[/code] Regards Huggie
-
Add the button to the page by pasting the following code in where you want the button: [code] <form name="update" method="GET" action="$_SERVER['PHP_SELF']"> <input type="submit" name="submit" value="Lock top 16"> </form> [/code] Then paste this into the php... [code] <?php if (isset($_GET['submit'])){ $sql = "UPDATE ladders_7 SET status = 20 WHERE rank <= 16"; $result = mysql_query($sql) or die ("Cannot execute $sql: " . mysql_error()); if ($result == true){ echo "Top 16 successfully locked"; } else { echo "Error while locking top 16"; } } ?> [/code] Regards Huggie
-
For starters, your variable is called $randimnum[color=red][b]r[/b][/color] and you refer to it as $randimnum (note the missing r off the end). Regards Huggie
-
Oh ok... The sql for that should be quite simple... [code=php:0]$sql = "UPDATE ladders_7 SET status = 20 WHERE rank <= 16"; [/code] That should do the trick. This assumes that there's only one team to each rank, e.g. no joint 1st place etc. Also that your table column for rank is called rank. If teams can share rank then you can still do it by using the following command... [code=php:0]$sql = "UPDATE ladders_7 SET status = 20 ORDER BY rank LIMIT 16"; [/code] It's an odd query, but valid I believe. Regards Huggie
-
This is in the wrong forum really, it's not a php problem, it's an HTML issue. Have a look at the w3schools tutorial mentioned in my signature and do the 'html tables' tutorial. Regards Huggie
-
I guess in it's simplest format, you need a single table with three columns... [b]Downloads[/b] fileID - (int) unique/auto-increment fileName - (varchar) filePath - (varchar) Regards Huggie
-
Are you able to provide an example in your explanation, maybe some test data, as I found the description a little confusing. Regards Huggie
-
I didn't even notice that :( Huggie
-
Use the header() function... [code] <?php if ($var == 1){ header("Location: index.php"); } elseif ($var == 2){ header("Location: contact.php"); } else { header("Location: error.php"); } ?> [/code] Regards Huggie
-
ok, change this line: [code=php:0]$query = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pass'"); [/code] To this: [code=php:0]$query = mysql_query("SELECT * FROM users WHERE username='$user' AND password='$pass'") or die ("Can't execute: " . mysql_error()); [/code] And see what you get. Regards Huggie
-
Can you post your full code again now? Regards Huggie
-
[quote author=Balmung-San link=topic=110150.msg444763#msg444763 date=1159721726] It would also be good to tell you that session_start() needs to be the first thing in your script. [/quote] That's not entirely true, but it has to be specified before anything is output to the browser. I think it's good practice to put it at the top of the script though and you're more likely to remember it that way. As for the problem, you'll probably find that mysql_query() returned false rather than true, so as previously stated, your SQL is probably not quite right. What's the statement you're using? Regards Huggie
-
I'd say heredoc is what you need here... Where you start to echo the content, change [b]echo "[/b] to [b]echo <<<HTML[/b] and then add [b]HTML;[/b] above [b]$i++[/b]. Regards Huggie
-
Does it give you a line number? Can you paste the actual error message? Regards Huggie
-
You need semi-colons at the end of the PHP code... Your lines that end like this: [code=php:0]? "checked='checked'" : ''"> [/code] Need to have a semi colon after the php, before the last double quotes... like this: [code=php:0]? "checked='checked'" : '';"> [/code] Regards Huggie
-
ok, well my advice would be to post your code for us to take a look at. Regards Huggie
-
[quote author=Balmung-San link=topic=110097.msg444440#msg444440 date=1159651163] my logout script doesn't work. I do the setcookie() calls first thing in my script, set them both to blank with an expire time of time()-3600. Shouldn't that erase the cookies? [/quote] As you haven't posted your code for expiring the cookies, I have to guess what it looks like, but one piece of advice is make sure you you set it with the same amount of parameters. From the manual... [quote] Cookies must be deleted with the same parameters as they were set with. If the value argument is an empty string, or FALSE, and all other arguments match a previous call to setcookie, then the cookie with the specified name will be deleted from the remote client.[/quote] Regards Huggie
-
[quote author=intrik link=topic=110073.msg444247#msg444247 date=1159629440] [quote author=speedy33417 link=topic=110073.msg444219#msg444219 date=1159624279] You can't just echo <a href=dog.php?dogid=$dogid> [/quote] Yeah you can, I do it all the time. [code] <?php echo"<a href='page.php?a=$var'>"; ?> [/code] [/quote] Speedy, To explain a little further, and hopefully be a little more helpful than the previous post... When using double quoted strings " " the variable is read and the value of it is output. This is not true of single quoted strings ' '. So: [code]<?php $name = "HuggieBear"; echo "My name is $name"; // Prints My name is HuggieBear echo 'My name is $name'; // Prints My name is $name ?> [/code] I hope this helps. Regards Huggie