Wrong Id
I have a table named 'choose' with the fields site_id, user_id and values, with 2 rows :
row1 :
site_id = 1
user_id = 2
value = 0
row2 :
site_id = 4
user_id = 2
value = 0
I use the following form, that get's it's info from another table Code:
View Complete Forum Thread with Replies
Related Forum Messages:
What's Wrong W/this (if / Or) ?
When ppmode is set to "cancel" or "thankyou", the header and exit are still processed. I'm trying to search on "if" and "or" in google, but it keeps removing "or" from my searches. Is there something wrong w/this ? if (($ppmode != "cancel") or ($ppmode != "thankyou")) { header("Location: index.php"); exit(); }
View Replies !
Wrong Headers
I just transfered and patched up some files because I moved them from Linux/PHP/Apache/mySQL to Windows XP Home/PHP/Apache/mySQL. I fixed all the problems that come up, but, when I load the page in IE6, it reloads a bunch of times and just loads normally. I tried the best I can to make the page HTML 4.01 Transitional. So, on Linux, after I patched the page to be HTML 4.01 Transitional I put a link for my visitors to validate my page if they want to. So I notice also, that when I validate the page, I rarely get it to work. 90% of the time, this is what I receive from the W3C validator: Quote: I got the following unexpected response when trying to retrieve <http://*****/>: 500 Bad header: ' <img src="/images/menu/other_stuff-off.gif" alt="Other Stuff" name="menu-other_stuff" width="186" height="17" border="0">' Please make sure you have entered the URI correctly. I get this error most of the time, but sometimes there is a different part of my PHP HTML output in the page. And then, when it works, half of the page is trimmed off, thus, I get errors about my page not being HTML 4.01 Transitional. I tried a couple experiments with my layout code, and the same code makes the browser reload, and reload... I've tried debugging my layout code but it brought up nothing... I switched from the PHP module to using the CGI executable. Some things changed: The page no longer reloads repetitively; when the validator fails, I sometimes get a 'Header too long' message; using the validator brings success more often, but other letters are in the output (degree marks, little squares -- these don't appear when viewing the source of the page in IE6). Anybody know why this header is being sent by my server? *Note* I am not trying to load an image. I am trying to load a dynamic PHP page.
View Replies !
What's Wrong With This Code?
I keep getting parse errors on line 10 (the "if (isset($LOGINID)) {" line). Can any of you figure out why the hell I keep getting this? Is is just something simple I'm overlooking? And if you have any comments on my code (security, structure, tips, etc), I'd like to know as well... [edit] Oh yeah, the db_connect, db_array, db_query, and decrypt functions are all defined in database.php and crypt.php. PHP Code:
View Replies !
What's Wrong In This Code
$link = mysql_pconnect ($DB_SERVER, $DB_LOGIN, $DB_PASSWORD); $selectStmt = "SELECT * FROM user_profile WHERE userid = 'david'"; if (!($result = mysql_db_query($DB, $selectStmt, $link))){ header("Location:http://$HTTP_HOST/$DOCROOT/error.html"); exit(); } here is the case, the userid 'David' is NOT in the table 'user_profile', the program should launch the error.html, and exit(), But it is not.
View Replies !
What's Wrong With This Php Code?
I put the following php code inside my index.html page. I upload it to my host server (free.prohosting.com), change the extension to php (and another one with php3)and CHMOD it to 644. When i viewed it in a browser, the normal html appeared but the items inside the php code failed to appear. Can somebody help me to confirm whether there is something wrong with my php code (it is a news grabber code) or is it because my webhost don't support php (the unofficial FAQ says that the server support php). If there is something wrong with my php code, here is the code: PHP code:
View Replies !
What Am I Doing Wrong With This Regex
I'm just trying to check and see if this name is valid. I submit things like "12345" and it evaluates to true... function checkName ($name) { $status = FALSE; $pattern = "/^[A-Za-z]+$/"; if (preg_match($pattern, $name)); $status = TRUE; return $status; }
View Replies !
Preg_replace - What Is Wrong Here?
preg_replace - What is wrong here? Suppose I have this: $words = array('piece','people'); $profile_text = "I would like to meet people to help me to work in the world piece project."; $marked = MarkWords($profile_text, $words); Should return the same sentece but with the 2 words replaced with the <span> tag, am I wrong? function MarkWords($profile_text, $words){ for($i=0; $i<count($words); $i++){ $patern[$i] = "/@".$words[$i]."/"; $replace[$i] = "<span style='color:white'>".$words[$i]."</span>"; } // print_r($patern); // print_r($replace); $pro = preg_replace($patern, $replace, $profile_text); return $pro; }
View Replies !
Something Wrong With $_POST
I don't seem to be able to access the keys in an associative array. I have a script that dynamically generates a form. The form element names are generated based on image filenames, so I can't just access them the normal way in the form handler script. I tried looping through the $_POST array like this: foreach ($_POST as $key=>$value) { echo $key.'=>'.$value.'<br>' } and i get this output: 0=>Pay 1=>Pay 2=>on 3=>on 4=>tn__DSC2602.jpg 5=>tn__DSC2603.jpg Thos numbers are where I expected to see the form element names. Can anyond advise me on why this is happening?
View Replies !
PHP.ini File Wrong?
I run a test server of apache/php/mysql on my laptop. I just switched from one to another and I'm moving everything over. I downloaded the latest versions of each. (Found that apache 2.0 doesn't work very well and went back to 1.3) Everything is working, DBs are being hit properly and such except: $SERVER_ADDR is no longer being passed back to PHP. When I run PHP_INFO() it shows up there as 飗.0.0.1' as expected, but I can't pick it up in my code. I'm guessing there is something going on with the variables I have turned on/off. Any ideas?
View Replies !
What's Wrong With My Script?
<?php include"dbconn.php"; $db=mysql_select_db(creative_Articles,$connection) ; $Parent="SELECT DISTINCT 'Cat_Parent' FROM Category"; $mysql_Parent=mysql_query($Parent); while ($row=mysql_fetch_array($mysql_Parent)) { $Cat_Parent=$row["Cat_Parent"]; echo "$Cat_Parent"; } ?>
View Replies !
What Is Wrong With This Code?
I am trying to setup a set of radio buttons from a table. I am getting the error: Parse error: parse error, unexpected '[', expecting ',' or '' in /var/www/html/liberty/prototype1.php on line 251 This is the snippet of code. <?php $getnormwtA = getnormwt(); $numct = count($getnormwtA); $tab = 16; $wt = 'weight' $typ = 'radio' for ($i=0; $i<$numct; $i++){ echo "<input name=". $wt ." tabindex=". $tab ." value=". $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>". getnormwtA[$i]['bodyweightnorm'] .">"; $tab++; ?>} ?> This is line 251 echo "<input name=". $wt ." tabindex=". $tab ." value=". $getnormwtA[$i]['bodywtid'] ." type=". $typ ."/>". getnormwtA[$i]['bodyweightnorm'] .">";
View Replies !
What's Wrong With REBOL?
I first came across rebol a while ago; it seemed interesting but then i was put off by its proprietary nature, although the core of the language is a free download. Recently however, i can't help but say i was totally impressed. I needed an open source wikiblog/wikilog, whatever you wanna call it, basically a hybrid of a blog and a wiki. I checked out snipsnap, which uses java, it was said on their site to be a clone of vanilla, a wikilog written with rebol. I wanted an open source thing so i could modify it to my needs. snipsnap turned out to be, even apparent on the first day of use, way too far from being mature and reliable, and although they said it doesn't require a server, it required a download of the sun java sdk, which, when installed, was well over 400Mbs of space on my hard drive. Not to mention another over 100Mbs for the JVM. So as i needed a mature enough solution, but liked the way snipsnap worked, i looked around, and on freshmeat i found vanilla, with a development status of 5; production/stable. I went to its site, where a working demo impressed with its capabilities. The site is though poorly documented, very poorly documented i had to use trial and error to work out how to install it. Anyhow, what impressed me was that the download, which was less than half a megabyte, installed vanilla, which is the wikilog, an apache server, and the rebol interpreter, which is the free download version. And it self-installed! It turned out to be a very very capable wikilog, and highly extensible. I am still amazed and impressed by it after a couple of days of use. Rebol itself seemed a very easy to read language. Sorta like ho readable SQL is. I might even say more readable than python or ruby, or at least as readable. I have the intention to learn it over the coming few days, at least to customize vanilla to my needs. So i ask you guys, what's wrong with Rebol? i mean other than it's proprietary nature. 'cos anyway, there are many commercial IDEs for open source languages, and if smitten enough i might even consider a rebol SDK. It just amazes me for how readable it is, how much it seems to enable to do with so little code, and the size and capability of the final solution.
View Replies !
What Is Wrong With This Line ?
It has to be something with the characters, right ? $search = array(".", "", "+", "-", "*", "/", "!", "%", ">", "<", "^", "(", ")", "[", "]", "{", "}", "", "=", "$", "#", "?", "~", ":", "_", "&", "©", " ", """, "ü", "&", ";", " "); $line = str_replace($search, " ", $line);
View Replies !
What Is Wrong With This If Test?
I am at a toral loss after having programmed for forty years. Here are my results: selHint_2=1 It is clear that for the second time through the loop ($i=1) that $index=1 and $selHint_2=1, while for the first pass through ($i=0) $index=0 and $selHint=1. Yet, the " selected " comes up for the first time and not for the second. It should be the other way around. Any clues? Here is the code: $numHint_2 = 2; $hint_2_Lookup = array(0, 1); $hint_2 = array(); $hint_2[] = " Family member's name"; $hint_2[] = " Mothers maiden name"; $foo = ""; // put in for debugging only $tmpHint2 = array(); $tmpHint2[] = '<td class="stdBold"' . $readonly . '>' $tmpHint2[] = '<select name="hint_1" value="" >' for ($i=0; $i<$numHint_2; $i++) { $index = $hint_2_Lookup[$i]; if ($index == $selHint_2) { $sel = " selected "; } else { $sel = ""; }
View Replies !
Age Function Wrong
I have this code to show a users age on there profile, The problem is it shows the correct age for some users and the wrong age for others. Example birthdate 1983-04-21 should show age 24 but instead returns age 23. PHP Code: //calculate years of age (input string: YYYY-MM-DD)   function birthday ($birthday){     list($year,$month,$day) = explode("-",$birthday);     $year_diff  = date("Y") - $year;     $month_diff = date("m") - $month;     $day_diff   = date("d") - $day;     if ($day_diff < 0 || $month_diff < 0)       $year_diff--;     return $year_diff;   }
View Replies !
PHP Time Is Wrong
I just installed php 5.1RC1, mysql 4.1.14, apache1.3.33 on a windows 2000 server machine. Anyway some wierd bugs are happening, the time for the server is incorrect. The time set on the machine is right, the time in the apache error log is right, but when i do a simple time() call in php is gives some ridiculous time like 6:30PM and its really 2:01PM. another problem i just remembered was something i'm hoping is simple. I do a simple printing of the date using the date function. I believe i did something like this, $today = date("F j, Y, g:i a"); From what i remember it had a "f" after the month and the year was repeated twice. The day and month were correct though. Anyone know whats going on? I'm not at the machine now but once they set up their vpn and can go in and change whatever it is.
View Replies !
Date()'s Wrong.
so I'm using echo date ("r"); and it's returning the time an hour late. Is that set wrong on the server? And if so how to go about fixing that. email them I guess? I mean, I guess I could learn to parse nist.gov output, but that seems like alot of trouble for something so small. Since I don't have another box to check with, could someone click my site link below and tell me if the time in the nav bar is late for them also?
View Replies !
Query Right Or Wrong
this errors out and i dont know why. PHP Code: $sql = "SELECT s.`id`, s.`topic`, s.`username`, s.`date`, s.`subject`, s.`post` COUNT(c.`posts_id`) AS `ct` FROM `forum-posts` s LEFT JOIN `forum-reply` c ON s.`subject` = c.`posts_id` WHERE `topic` = '$topic'";
View Replies !
If Else Statement Wrong
Could anyone tell me what's wrong with this code? <?php If ($CategoryName == 'U-100') { ($UnitPrice = 500); } else if ($CategoryName == 'U-130') { ($UnitPrice = 400); } else if ($CategoryName == 'U-105') { ($UnitPrice = 350); } else if ($CategoryName == 'U-95') { ($UnitPrice = 200); }else if($CategoryName == 'U-85') { ($UnitPrice = 445); $Total = $ProductUnits*UnitPrice echo $Total ?>
View Replies !
PHP Fetch_array() WRONG
I have this simple code: <?php include("connect.php"); $sql = "select * from post"; $res = mysql_query($sql); $row = mysql_fetch_array($res); echo $row['post_id']; ?> But the page result is this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in #############index.php on line 5.
View Replies !
Mod Rewrite Went Wrong
half a year ago I outsourced a mod rewrite on a client's site. I think what the coder did is set up a customized 404.php. The site lost a lot of traffic recently, on Google, every url has no title and snipet but just a url. Every rewritten url is returnning a "404" responds before it displayes actually content. And it is believed that Google finanly decided not to index these pages anymore. Code:
View Replies !
4 XML: Whats Wrong With This?
All i need is someone to help me with my script so that every node in the array goes through the if..else.. statments, with the end result of an array of $albums and an array of $images. Code:
View Replies !
Wrong Download Name
I just came onto a project where a visitor downloads a file after hitting a button. The button goes to a .php file and then uses header functions to initiate the download. The problem is after a server switch, the .exe is file is downloading as filename.php. The download is the file seeing as renaming it to .exe makes it run properly. Code:
View Replies !
Wrong Header
Please, my script makes it possible to upload documents and metadata to mysql, document in blobs. My script works well as I access it in the folder it resides. BUT when I try to include it in a slightly another path in the file structure the header information disappear and when I try to download the files I only get noise code. What on earth can I do? Nothing is changed in the script, the paths are paths.
View Replies !
Wrong Filesize Download
I have a image displayed on my site, and theres a button that says download this image, when a user click on the button, this is called. PHP Code:
View Replies !
Session_start() Works Wrong For Me
I have problem with sessions. I make this without cookies but by propagate session ID by GET. I have make session by calling session_start() after test login and password with database. After that i register a one session variable. My problem is when i later call session_start(). This (second) call make me new session (second), but not rectivate and introduce back frozen variables of my first (correct) session to the global namespace. I think this situation happens when URL doesn't contain session ID. Is the reason or maybe something else?
View Replies !
Phpinfo() - Wrong System Name
I built an Apache 1.3.26 binary with PHP 4.2.1 support for AIX. When I used this binary on another system, it worked great, the only thing that bothered me is when I created a test page using the phpinfo() function, the "System" field has the hostname of the machine I created the binary on.
View Replies !
What Is Wrong With This Piece Of Code
I am using a piece of code which is testing if a certain variable is <=0. and the code is written as follows: $lc_align = 'center' if ($listing['products_quantity']<=0) { $lc_text = tep_image_button('button_buy_now_na.gif', IMAGE_BUTTON_BUY_NOW_NA) . ' ' } else { $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ' } break; } The problem I am facing is that the this code returns all result to be true ie. <=0 even though most of the variable are greater than 1. Is the test wrong? Or can I change the syntax and how do I do that
View Replies !
Problem With Array - What's Wrong?
I'm using <pre><?php print_r($_POST['dane']); ?> </pre> and i'm getting this: Array ( [1] => Array ( ['zamow'] => Array ( [0] => 1 ) )} So then i tried <pre><?php print_r($_POST['dane'][1]); ?> </pre> Array ( ['zamow'] => Array ( [0] => 1 ) )But when i'm trying with:<pre><?php print_r($_POST['dane'][1]['zamow']); ?> </pre>I'm getting no resultsWhat is wrong? What should to see result?
View Replies !
Wrong If Statement Logic
I am trying to upload images using either exec command. The file is uploaded ok. My script: <html> <head> <title>Picture Upload Page</title> <?php if ($_POST['upload']=="upload") { $fnamefrom = ' ()/\%"'."'^&*@!`~"; $fnameto = "+__________+___"; $fname = strtr($pic_name,$fnamefrom,$fnameto); if ($pic_size > 0) { $upload_file = system("/bin/cp $pic /mnt/raid/WWWROOT/lexon.ws/imgstore/$fname", $retval); if ($upload_file) { $goodsave = 1; } else { echo "error while uploading files"; }; }; } else {echo "no submit";}; ?> </head> <body> <?php if ($goodsave == 1) { ?> <p>The picture, $pic, was successfully saved to the server.</p> <?php } else {echo "NOT SAVED!!!";}; ?> <form action="<?php echo $PHP_SELF?>" method="post" enctype="multipart/form-data"> <input type="file" name="pic" size="25"> <input type="submit" name="upload" value="upload"> </form> </body> </html> I still receive error NOT SAVED and error uploading files. Is something wrong with my logic.
View Replies !
Wrong $id Inserting Into Database
I'm working on "user comments" for my forums and when someone clicks the users name to go to there profile the url will come up profile.php?id=whatever and the user comments are in the peoples profiles anyways after they submit there comment the insert the profiles id into the column 'id in the database but I don't want that I want the id just to rise in number from 1 to whatever when a user leaves another comment. PHP Code:
View Replies !
Wrong Mime Type
I tried to reply to another post, and instead of receiving html, my browser came back with a mime type of x-something-php and prompted me to open/save the document. I tried several other links on the page, got similar responses, restarted the browser, tried others... It seems to be working properly now, but I'm currently in possesion of two of devshed's php scripts. So my question is, what happens when my server does this and database passwords/schema information/obscene comments whatever are exposed to user download? Is this a known issue? What could cause this to happen? I'm using mozilla 0.9.8, but this seems like a server -side issue to me.
View Replies !
What Is Wrong With My Mail() Function
I have the following code in my code <?php $mail_to="abc@example.com"; $mail_from=$_POST['from']; $mail_sub="WebmasterWorld Example"; $mail_mesg=$_POST['content']; if(mail($mail_to,$mail_sub,$mail_mesg,$mail_from)) { echo("<span class='textred'><b>Thanks for your contribution<b> </span>"); } else { echo("<span class='textred'>Submission Failed.Please retry. </span>"); } ?> Here 'from' and 'content' are a text box and text area respectively. I cannot find my mistake here..On clicking, I do get my thank you message..But the mail never gets delivered to my e-mail.
View Replies !
What Is Wrong With This Mail Script
$msubject = "Price Change"; $tomail = "yoelg...@yahoo.com"; $mfrom = "From: Baltimore Trails <i...@baltimoretrails.com> "; $mbody = "text....asdfasdfasdfasdfasdfa*sdf"; $bcchead1 = "Bcc: i...@baltimoretrails.com "; $bcchead2 = "Bcc: yoelg...@baltimoretrails.com "; $header = "$mfrom $bcchead1 $bcchead2"; mail($tomail, $msubject, $mbody, $header); ------------------------------------------------------- this is what yoelg...@baltimoretrails.com email looks like: the From field in MS outlook = "Baltimore Trails Bcc: yoelg...@baltimoretrails.com" and the To: field = "yoelg...@yahoo.com" how do I make that the email in the bcc field should not see the To field, they should see there email in the to field? and why is the from field the way it is? As far as the email for yoelg...@yahoo.com everything seems to be fine with that
View Replies !
Passing Variable Using Url - What's Wrong?
I want to send a variable to my script using url. I don't know why but echo in "szczegoly.php" display nothing... // strona1.php <A HREF="./szczegoly.php?nazwah=$nazwa_hotelu">$nazwa_hotelu</A> //szczegoly.php <?php echo "<p>{$_GET['nazwah']}</p>"; ?>
View Replies !
Win98 + Apache 1.3.up + PHP 4.3.up Something Wrong
I been first times setup. So Who have experience the Win98 + Apache + php (not run PWS or IIS) I begin download and installed the Apache. I test the run is working on browser (http://localhost) show the apache page. But Apache Console Running under the DOS Window say :- ===================================== [Thu Nov 20 15:13:49 2003] [warn] (2)No such file or directory: exec() may not be safe Apache/1.3.29 (Win32) running... ===================================== I expect that it. So, I shall the php installer from download. I try changed the httpd.conf under the Apache directory. Restart Apaches Console. I testing the (http://localhost/test.php), show error page say "HTTP - Error 400 Bad Request" also "HTTP - Error 404 Not found" I have tried times.... But unknown.... Apaches Directory - c:apacheapaches*.* PHP Directory - c:apacheapachesphpwin32*.* httd.conf -: (was add the line) ScriptAlias /php/ "C:/Apache/Apache/phpwin32/" AddType application/x-httpd-php .php AddType application/x-httpd-php .phtml Action application/x-httpd-php "/php.exe" I didn't change php.ini yet I copy and paste the "php4ts.dll" under to C:windowsystem from PHP What I have done that above ?
View Replies !
Wrong Dates In A Schedule
I am using the following code (many thanks for the code folks BTW) to generate 3 schedules in three tables one is a schedule with 7 day intervals and two are daily schedules. The two daily schedules seem to have out of sync dates at the start of each schedule. The dates look as if they may be dates from the preceding loop. I am presuming that I need to reset something after the completion of each loop but I am not sure what. $now = time(); $day = $now + 7*24*60*60; $cutoff = strtotime("+$months months"); while ($day <= $cutoff) { $date = date('Y-m-d', $day); $insert = "INSERT INTO daily_data SET subscr_id='$subscr_id', date='$date'"; mysql_query($insert); $day = $day + 7*24*60*60; } //then create a daily schedule in the excercise table for($i=0;$i<=($sched);$i++) mysql_query("INSERT INTO exercise_data SET subscr_id='$subscr_id', date=date_add(now(),INTERVAL LAST_INSERT_ID() DAY)"); //then create a daily schedule in the food and diet table for($i=0;$i<=($sched);$i++) mysql_query("INSERT INTO food_data SET subscr_id='$subscr_id', date=date_add(now(),INTERVAL LAST_INSERT_ID() DAY)");
View Replies !
Wrong Version Of DBG(2.11) -> 2.12 Is Needed...
I use Linux RH 9 and Phped 3.1 and recently downloaded latest sources of dbg and i think it's is installed all right in my php4.3.2 cause i see in phpinfo() a dbg enable row. But when i try to run the Phped debugger, it doesn't work... Wrong version (2.11) of php debugger detected. DBG 2.12 is needed to start debug session. Where i can download?
View Replies !
Query With INSERT Going Wrong
Im trying to input text in to a db using a form. But i cant get it to work. It says the query wont work. PHP Code: $dblogin = "xxxx"; $dbpassword = "xxxx"; $host = "xxxx"; $dbname = "xxxx"; $connection = "mysql_connect($dblogin, $dbpassword, $host)" or die("connection klopt niet"); $db = "mysql_select_db($dbname, $connection)" or die("db klopt niet"); $query = "INSERT INTO contact2 (naam, email, bericht) VALUES (test,test@hotmail.com,test)" or die("werkt niet"); $result = mysql_query($query) or die("werkt niet 2");
View Replies !
Wrong Values Being Inserted
I have this script that is supossed to change the pet image to $image and the growth to ƈ' but for some reason it sets the image to Ɔ' and doesn't do anything to the growth. I have rewriten the script 3 times and I just can't see what is wrong. <? //connection information $db_name = "DBNAME"; $connection = mysql_connect('SERVER', 'NAME', 'PASS') or die($connection); $db = mysql_select_db($db_name, $connection) or die("Couldn't select Database1."); $connection2 = $connection; //sets the growday $growday = date("M d Y"); //selects pets that are ready to grow ..................
View Replies !
Whats Wrong With Magic_quotes_gpc?
People say magic_quotes_gpc should be turned off in php.ini but I dont see the problem?! $name = "O'reilly"; Would be O'reilly - therefore saving the extra line of code to addslashes. So why should it be turned off?
View Replies !
Wrong Parameter Count
I want users to be able to edit the color of the text, so I've set up the values of a drop down form to be decimal color codes. When the user submits the file, the variables are written to a file like Code:
View Replies !
|