Imtehbegginer
-
Posts
53 -
Joined
-
Last visited
Never
Posts posted by Imtehbegginer
-
-
Thanks!
-
if (($_POST['str'] + $_POST['int'] + $_POST['con'] + $_POST['dex']) > $row['statp']) { die('Not enough points!'); } $stats_new = $_POST['str'] + $_POST['con'] + $_POST['dex'] + $_POST['int'] = $ $result = mysql_query("UPDATE characters SET str = '".$_POST['str']."' WHERE char_name = '".$_GET['char']."'"); $result = mysql_query("UPDATE characters SET dex = '".$_POST['dex']."' WHERE char_name = '".$_GET['char']."'"); $result = mysql_query("UPDATE characters SET con = '".$_POST['con']."' WHERE char_name = '".$_GET['char']."'"); $result = mysql_query("UPDATE characters SET _int = '".$_POST['int']."' WHERE char_name = '".$_GET['char']."'"); [b]$result = mysql_query("UPDATE characters SET statp = '".$_POST['statp']."' WHERE char_name = '".$_GET['char']."'");[/b]
I wish to know, how I take away the amount of $_POST['str'] + $_POST['con'] + $_POST['dex'] + $_POST['int'] from the statp row.
-
I was wondering if I could give an error, that would STOP the script, but not cut out the rest of the page?
Is there anyway to do this?
For example.
if($pass != $pass2) {
die('Passwords do not match!'); # This is where it deletes half of the page....
}
-
Thanks alot!
-
<?php $re = mysql_query("SELECT * FROM characters"); $row = mysql_fetch_array($re); $str = $row['str']; $con = $row['con']; $int = $row['_int']; $dex = $row['dex']; $lvl = $row['level']; ?>
All of them are echod into a space for the user to see there current character points.
There is a row: statp, that's how many points they have.
How can I make sure that the input of str, con, dex, and int dont go over the amount in the statp row?
-
Sorry!! Wrong section!
-
<?php echo " <select name='myjumpbox'> <option selected>Select a character.... <option value=''>".$datas['username']." <option value=''>".$datas['username']." </select>"; ?>
How can I make the 2nd row of username to come up instead of only the first?
-
Remove the numbers from $query2 and $result2, make them $resultwo, or $querytwo
-
Try switching all of the $cfg to $cfg['NAMEHERE']
-
I am developing a script for a game, and I was wondering, how I can get the "Character Names" printed into a select menu, one by one, doesnt matter what values. But here is my code.
<?php $ptr = mysql_query("SELECT * FROM characters WHERE account_name = '".$_POST['user']."'"); $chardata = mysql_fetch_array($ptr); $str = $chardata['str']; $dex = $chardata['dex']; $con = $chardata['con']; $int = $chardata['_int']; ?>
The account name is in a row with char_name, how can I print it into a <select><option></select></option> menu?
AND when you select it, make it go to a certain page?
-
Works, thanks.
-
Wierd...
My code:
$str = mysql_query("SELECT str FROM characters WHERE char_name = '".$_POST['char_name']."'"); $dex = mysql_query("SELECT dex FROM characters WHERE char_name = '".$_POST['char_name']."'"); $con = mysql_query("SELECT con FROM characters WHERE char_name = '".$_POST['char_name']."'"); $int = mysql_query("SELECT _int FROM characters WHERE char_name = '".$_POST['char_name']."'"); $lvl = mysql_query("SELECT level FROM characters WHERE char_name = '".$_POST['char_name']."'");
The str in the characters table = 15, but when I do: <?php echo $str ; ?> I get "Resource #7" any ideas?
-
My code:
[code]<?php
// LOGIN
include 'includes/connect.php';
$query_select_login = mysql_query("SELECT username FROM accounts WHERE username = '".$_POST['username']."'");
$query_rows = mysql_num_rows($query_select_login);
// Check for the username above.
// Now we check the rows
if($query_rows = 0) {
die("There is no such username in the database.");
} else {
echo "";
}
$query_select_pass = mysql_query("SELECT password FROM accounts WHERE password = '".$_POST['password']."'");
// THIS IS WHERE PHPFREAKS HELPS ME.[/code]
How can I make the password select from the row of that username? -
Some of the install scripts, like SMF, and IPB, vBulletin, and others.
Have a folder named "sql". I wana know how to execute one of the scripts in there, from the install script itself.
Can anyone tell meh..? -
That works,
Now I get
Brett19DeathcodeGenesisStrikeXRoseBot All of the rows together. How can I split them up? -
[code]<?php
include 'config.php';
$result = mysql_query("SELECT char_name FROM characters LIMIT 5")
or die(mysql_error());
$echos = $row['char_name'];
echo $echos;
?>[/code]
That's my code, my config.php file connects to mysql. It doesnt show anything, just shows a blank page. -
Awsome! Thanks alot.
-
Hey,
I was just wondering, how to select, only the TOP 5 rows. Not all of them, just the top 5. Can anyone tell me how to do this? -
Here is my code
[code]<HTML>
<HEAD>
<TITLE><?php include 'config.php';
echo $config['servname'];?></TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="stylesheet" HREF="styles/style.css" TYPE="text/css">
<style type="text/css">
<!--
.style1 {color: #999999}
-->
</style>
</HEAD>
<BODY BGCOLOR="323232" TEXT="#000000" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0">
<TABLE WIDTH="10%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER"><TR><TD><IMG SRC="images/interface_01.gif" WIDTH="800" HEIGHT="110"></TD></TR><TR><TD><TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD BGCOLOR="494E52" WIDTH="4%" BACKGROUND="images/interface_11.gif" VALIGN="TOP"><TABLE WIDTH="0%" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR><TD><IMG SRC="images/interface_02.gif" WIDTH="163" HEIGHT="20"></TD></TR><TR><TD BACKGROUND="images/interface_05.gif"><TABLE WIDTH="81%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="RIGHT"><TR>
<TD CLASS="text1"><A HREF="index.php">Home</A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="<?php include 'config.php';
echo $config['forum'];?>">Forums</A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="rankings.php">Rankings</A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="download.php" target="_self">Downloads</A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="stats.php">Statistics</A></TD>
</TR></TABLE></TD></TR><TR><TD><IMG SRC="images/interface_06.gif" WIDTH="163" HEIGHT="22"></TD></TR><TR><TD BACKGROUND="images/interface_07.gif"> </TD></TR><TR><TD><IMG SRC="images/interface_08.gif" WIDTH="163" HEIGHT="28"></TD></TR><TR><TD BACKGROUND="images/interface_09.gif"><TABLE WIDTH="81%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="RIGHT"><TR>
<TD CLASS="text1"><A HREF="usercp.php">Members Area </A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="admincp.php">Admin Area </A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="register.php">Register</A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="cpass.php">Change Password </A></TD>
</TR><TR>
<TD CLASS="text1"><A HREF="rpass.php">Recover Password </A></TD>
</TR></TABLE></TD></TR><TR><TD BACKGROUND="images/interface_09.gif"><IMG SRC="images/interface_10.gif" WIDTH="163" HEIGHT="20"></TD></TR><TR><TD BACKGROUND="images/interface_11.gif"> </TD></TR></TABLE></TD><TD WIDTH="89%" BGCOLOR="494E52" VALIGN="TOP"><DIV ALIGN="CENTER"><SPAN CLASS="pagehead">
<BR> HOME</SPAN><BR><BR></DIV><TABLE CELLPADDING="1" CELLSPACING="0" BORDER="0" BGCOLOR="#000000" WIDTH="266" HEIGHT="25" ALIGN="CENTER">
<TR> <TD WIDTH="264"><TABLE CELLPADDING="1" CELLSPACING="0" BORDER="0" BGCOLOR="7E9AB8" WIDTH="159" HEIGHT="25">
<TR> <TD WIDTH="157" BGCOLOR="737C83"> <TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" BGCOLOR="#ffffff" WIDTH="391">
<TR> <TD HEIGHT="45" BGCOLOR="5C6368"><DIV ALIGN="CENTER"><BR><TABLE WIDTH="94%" BORDER="0" CELLSPACING="0" CELLPADDING="0"><TR>
<TD CLASS="news"><p>Server Rankings </p> </TD>
</TR><TR>
<TD CLASS="pagehead">
<table width="302" height="115" border="0" align="center" class="text1">
<tr>
<td width="80"><span class="style1">Name</span></td>
<td width="64"><span class="style1">Level</span></td>
<td width="51"><span class="style1">Zuly</span></td>
<td width="79"><span class="style1">Class</span></td>
</tr>
<tr>
<td height="29"><?php
include 'config.php';
$result = mysql_query("SELECT level, char_name, zuly, classid FROM characters ORDER BY level DESC")
or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo $row['char_name'];
include ('modules/class.php');
echo "</td></tr>";
}
?> </td>
<td> </td>
<td><?php
include 'config.php';
$result = mysql_query("SELECT level, char_name, zuly, classid FROM characters ORDER BY level DESC")
or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo $row['level'];
include ('modules/class.php');
echo "</td></tr>";
}
?></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br></TD>
</TR></TABLE>
<BR>
<BR></DIV></TD></TR> </TABLE></TD></TR> </TABLE></TD></TR>
</TABLE><BR><BR>
<BR>
<BR><BR><BR><BR><BR><BR><BR></TD><TD WIDTH="7%" BACKGROUND="images/interface_04.gif" VALIGN="TOP"><IMG SRC="images/interface_04.gif" WIDTH="52" HEIGHT="10"></TD></TR></TABLE></TD></TR><TR><TD><img src="images/interface_12.gif" width="800" height="71" border="0" usemap="#Map">
<map name="Map">
<area shape="rect" coords="652,54,769,84" href="http://www.clantemplates.com" target="_blank">
</map>
</TD>
</TR></TABLE>
</BODY>
</HTML>
[/code]
But Im only getting the FIRST row.. how can I get the 2nd, third, fourth and so on? -
Hi guys,
I am developing a script for a friend, and im creating a sort of admin script, and in the mysql database, the column 'accesslevel' has to be 300 for you to access it.
Can someone write a little code to show meh how to do it?
Thanks. -
[code]<?php
$filename = 'config.php';
$somecontent = "<?PHP
$databasehost = $databasehost
?>";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?> [/code]
Install.php posts to this, that's where I get the $databasehost variable from.
Now, when I try to write the $somecontent It writes the whole script. Dont I have to use $_POST['var'], if I use that, I get a different error. A while back, wildteen88 posted one for me. -
:-\ It doesnt work, It just writes the whole script over again, and if it put $_POST['varname'] I get a huge error :S.
-
Thanks alot :)
-
Everyone knows about the [b]f[/b] functions.
fopen
fwrite
fclose
Can anyone put together a small script, that will write to a file called config.php. Ill config everything else myself. Just a script that will open the file, write to it, and then close it. Please include a few text boxes.
Arrays.
in PHP Coding Help
Posted
I have a huge item file.
Also a file items_add.php, that on each line it has a new item id. it is included. How can I make it so that in the items_add.php file, it will echo the name FROM the itemid in the array.