
True`Logic
Members-
Posts
59 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
True`Logic's Achievements

Newbie (1/5)
0
Reputation
-
declare the variables before the loop. $email=""; $name="";
-
I'm sorry if this post is spam, but could you please put your code in the <php> tag and the text file in the <code> or <quote> tag? (replaceing < with [ and > with ], and dont forget to close the tags (</php>))
-
so you're trying to do something like this? <?php $testarr = {3, 5, 7, 10, 14}; $min = 4; $max 9; function Check($low, $high, $check) { if(($check >= $low) && ($check <= $high)) { return "img/bullet_green.png"; } else { return "img/bullet_red.png"; } } echo "<table border=1 cellspacing=0 cellpadding=1>\r\n"; for($i = 0; $i < count($testarr); $i++) { echo "<tr><td>$testarr[$i]</td><td><img src=\"" . Check($min, $max, $testarr[$i]) . "\" alt=\"\" width=\"8\" height=\"8\"></td></tr>\r\n"; } echo "</table>"; ?>
-
$username = $_POST['username']; $query = mysql_query("select * from user where username =\"$username\""); if($query["password"] == md5($_POST['password'])) { // success } else { // fail } don't forget to check datbase.php and make sure the info contained is correct. Check your mysql database and make sure your table user contaisn the correct fields. If the password in the database is saved as md5, you're good, if not, use md5() on $query[password] as well.
-
PHP MSSQL extension not loaded
True`Logic replied to lostconjugate's topic in PHP Installation and Configuration
IIS7 or any webserver by microsoft is almost always sub-par and requires a lot of manual configuration. If you would like to have your web server up and running and capable of using nearly all php related capabilities, search up an apache server package called "XAMPP". Install it, check "Svc" next to Apache and MySql on the control panel that comes with the package, and start those two up ("Start" buttons next to each one's name.) Invision Power Board is quite a good forum, however you may have problems with spam bots. There are a lot of bots for advertising porn and viagra that target invision power boards, so be prepared to put up some kind of defense against that. Good luck to you and your company! don't forget to ask if you or any of your developers need help with anything! -
You should look into "Offset" and "limit" for the mysql_query functions. If you would like examples, we can give you a few.
-
Beginner here...can't get strlen to work right
True`Logic replied to dmaar's topic in PHP Coding Help
You've figured it out, but in case you have further questions on preg_match: http://www.php.net/manual/en/function.preg-match.php -
Try this: in "phpdata.php" put <?php /*---¶ $dbhost = "localhost"; // DATABASE HOST IT IS USUALLY LOCALHOST $dbuser = "mrjohn1_btcs"; // DATABASE USERNAME $dbpass = "startrek"; // DATABASE PASSWORD $dbname = "mrjohn1_bcstcs"; // DATABASE NAME $dbprefix = ""; // DATABASE PREFIX (if needed, used for multiple sites and 1 database) ¶--*/ ?> then in your isntall script: $phpdata = ""; $php_get_data1 = fread(fopen("phpdata.php", "r") filesize("phpdata.php")); $php_get_data2 = explode("¶", $php_get_data1); $phpdata .= $php_get_data2[1]; $ret .= "<?php\r\n" . $phpdata . "\r\n ?>";
-
Everywhere where installing is going to modify the file put a character tht is unused (Like ¶ or $chr(173), which is an invisible character that takes up no space.). Then load the file into a variable; explode("¶", $var-name) or explode($chr(173), $var-name) into another variable. for example: TitlePage.html contains: <html> <title>¶</title> <body><h1><center>Welcome To ¶ </center></h1></body> </html> you will: <?php $new_title = "Page Title"; $site_name = "Site Name"; $base = fread(fopen("TitlePage.html", "r"), filesize("TitlePage.html")); $data = explode("¶", $base); $ret = $data[0] . $new_title . $data[1] . $site_name . $data[2]; @fwrite(fopen("TitlePage.html", "w"), $ret) or die("Failed to edit TitlePage.html"); echo "Title Page Editted."; ?> From ehre you should be able to understand and modify what you need. If you need further help, feel free to post! -T`L [First psot since July 2006... who remembers me? !]
-
if(stristr($_SERVER["HTTP_HOST"], "127.0.0.1")) { //admin } else { //not admin }
-
Stable & Best way to INSERT INTO mysql from PHP
True`Logic replied to nightkarnation's topic in PHP Coding Help
<?php //--mysql_connect stuff--// function newentry($id) { $sqls = "update TABLE set "; $sqle = " where id=$id"; mysql_query("insert into TABLE(id) values('$id')"); mysql_query($sqls."VARRIABLE=VALUE".$sqle); mysql_query($sqls."VARRIABLE=VALUE".$sqle); mysql_query($sqls."VARRIABLE=VALUE".$sqle); mysql_query($sqls."VARRIABLE=VALUE".$sqle); //--etc } ?> (on one of my php games the signup line was so long that mysql wouldn't handle it, so I had to resort to this method, it works though .. the reason for $sqls and $sqle is simply to save space\time when writing it) -
hehe I used to do this before I used mysql.. try.. <?php //--MYSQL_CONNECT ETC GOES HERE--// $ft = fread(fopen("FILENAME.txt", "r"), filesize("FILENAME.txt")); $fr = explode(" ", $ft); $i = 0; foreach($fr as $value) { $fa = explode("|", $value); @mysql_query("insert into TABLE(CustNum, CustName, AR_ADD1, AR_ADD2, AR_ADD3, AR_ADD5, AR_TELNO) values('$fa[0]', '$fa[1]', '$fa[2]', '$fa[3]', '$fa[4]', '$fa[5]', '$fa[6]')"); } ?> that's how I did it anyway.. If I remember right..
-
sometimes it's better to seperate each set of clauses though, <? if (($r1 > 0)&&($r2<1)) { /* */ } ?>
-
that would be easier to do with a javascript onsubmit() clause rather than php validation, it is easy to do with php, but a far excess and unneccessary waste of time and effort, onsubmit you need to check if document.getElementById('pickN').value is the same as picknn etc.... you can do that quite quickly with a loop and then document.location.href if it passes the validation -T`L
-
<?php //.... normal connecting etc crap goes here $res = mysql_query("select * from TABLE where CONDITIONS"); echo "<table border=0 cellpadding=2 cellspacing=0><tr><td colspan=~N>CAT NAME</td></tr> "; for($i=0;$i<mysql_num_rows($res)) { $arr = mysql_fetch_array($res); echo "<tr><td><a href=PAGE.php?CONDITION=$arr[CON]>$arr[CON2]</a></td><td>ETC....</td></tr> "; } echo "</table>"; //.... etc ?> and on page 2... <?php //.....() $res = mysql_query("select * from TABLE where CONDITION='$_GET[CONDITION]'"); $arr = mysql_fetch_array($res); /* handle the data and display how you want it displayed */ /.....etc ?> hope this helped -T`L