Jump to content

peddel

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Everything posted by peddel

  1. Do u include this file into another file ? If so make sure u do not place a session_start() in that file ! Else i cant find a reason why this is happening ...
  2. Excuse me if i tought this would be enough to explain. Someone took the liberty to go over my code and found the problem. It has to do with my padding included in the width element of a table cell for IE But then again thx for your "constructive" answer ...
  3. Let me situate my problem : I am making a table trought PHP with MySQL data. I do this by using the echo - command and echo'ing some HTML basic code. Now when I run the script in Firefox my date - element is on 1 rule. When i run the script in IE my date - element is splitted on 2 rules. Example FF : 2009-02-02 IE : 2009- 02-02 How can i make it so that IE doesn't do this? Thx in advance !
  4. Ok from looking at ur code ur really at everything that is basic. First off all this should be placed under the MySQL forum, but i will make effort to make answer for u. First of all i wanna know if this is a page asigned in the action="" attribute of ur HTML form ? SO that i know for sure there is a field somewhere on the form that has a input with name = username. I will make an example that come close to what u need, ill add in comments to be helpfull. Make sure ur form is like this <form id="formUsername" method="post" action="connection.php"> <input type="text" size="35" /> <input type="submit" name="submit" value="check the form !" /> </form> The code of connection.php should look like this : <?php //no session needs to be started, just make ur form use the POST type so that we can get the value on the next page. //lets first get the value $username = $_POST['username'] //make connection to database mysql_connect('localhost','admin','admin'); mysql_select_db('database'); //check if ur friend is in $sql = "SELECT * FROM friends WHERE friends.username = '$username'"; $result = mysql_query($sql); //check if rows are found $value = mysql_num_rows($result); //now echo the right respons if($value == 0){ echo 'You are already friends'; }else{ $sql = "INSERT INTO friends (id,username) VALUES ('?','$username')"; $result = mysql_query($sql); } ?> Hope this helps getting u to understand it !
  5. I know that certain values of the php.ini file can be set by using the function ini_set(). More info on : http://be2.php.net/ini_set For ur problem u need to use <?php ini_set('display_errors',1); ?>
  6. Like i indicated ^^ But nice addon to my solution
  7. place ur function checkfield on top of ur page ur function is not yet declared so the page doesnt know the function make it like this <html> <body> <?php //insert functions first function check_field1($fname) { if(!preg_match("/[^a-zA-Z0-9\.\-\Ä\ä\Ö\ö\Ü\ü\ ]+$/s",$fname)) return TRUE; else echo 'Name is REQUIRED!'; return FALSE; } if ($_POST) { $Fname = $_POST["username"]; $Fmail = $_POST["usermail"]; $FAddress1 = $_POST["Address1"]; $FAddress2 = $_POST["Address2"]; $FCity = $_POST["City"]; $FState = $_POST["State"]; $FZip = $_POST["Zip"]; $FPhone = $_POST["Phone"]; $FSite = $_POST["site"]; $FComment = $_POST["comment"]; $to = "myemail@example.com"; $subject = "Guest Book Entry"; $from = "someonelse@example.com"; $headers = "From: $from"; $message ="\r\n Username: " . $Fname . "\r\n Usermail: " . $Fmail . "\r\n Address1: " . $FAddress1 . "\r\n Address2: " . $FAddress2 . "\r\n City: " . $FCity . "\r\n State: " . $FState . "\r\n Zip: " . $FZip . "\r\n Phone: " . $FPhone . "\r\n Site: " . $FSite . "\r\n Comments: " . $FComment; if(!check_field1($Fname)) { $error; } if($error == 0) { // If there are no errors then if (mail($to,$subject,$message,$headers)) { echo '<p>The Guest Book was updated. Thank You.</p>'; <center> <a href="Index.shtml">HOME</a> </center> } } } ?> </body> </html>
  8. indeed thats the problem open wordpad delete that " replace it with a new " from wordpad wich will make it work
  9. again post ur complete files, the first piece of code is not the complete code ... i cannot start guessing how it all works ...
  10. Im sorry but i get the idea that u were not the guy who build this code. It seems that the guys who programmed this knew exactly what he was doing, inserting stuff inside someone elses code is hard, and i should see the compleet project and think about it to find a solution. UR best shot is contact the guy who made this, since i cannot spare more time on this, im sorry.
  11. I think i found the reason of ur warning. It has to do with the FormatWeight($product[$field], false); function. Can u give me the code behind this function? Cuz i cant seem to find it
  12. First of all u get a warning and not an error. This means that ur code will continue to run till the end of the script, tough something seems to went wrong. Getting the illegal offset type - warning comes around when u try to acces an item in an array that is not there. Give me a minute to look into ur code and try to find a solution on why its not working. Can u enlighten me on what spot exact ur pushing ur addon into ur upper code? So that i can check with the error on what line exact he generates the warning. U can also just paste a new code example. Gtrz
  13. plz post both files completely so we can see how the transfer of variables is programmed
  14. Since PHP cannot process exclusive HTML tags u need to echo them Just do this and it will work : echo '<p>The Guest Book was updated. Thank You.</p>'; echo '<center>'; echo '<a href="Index.shtml">HOME</a>'; echo '</center>'; A tip for the parse errors ! This mostely means that php cannot understand what is at that line Just something to know in the future
  15. just add NULL on the position u dont need, and replace it when the time is right. For example : U want finally name age sex U first make array $person = array('Steven',NULL,'male'); Then when the time is right u add the age $person[1] = '24'; (2nd position)
  16. Thats not what i mean, since i wanna get the element at position "rowAmount - 1" (since arrays start to count from 0 the exact last position is achieved this way) "rowAmount - 2" (pre last element) I do NOT want to subtract a value of the array value ! But thx for the try
  17. My PHP is working perfectly when using this way to get the last row of a MySQL result array in PHP while($row = mysql_fetch_array($result)){ $rowLast = $row; } Then i just use $rowLast['name'] to get the name column of the row. So far everything works. What i need now is to be able to store the last row and the pre - last row. I wanted to do this by using this code $rowAmount = mysql_num_rows($result); $rowPreLast = $result[$rowAmount - 2]; $rowLast = $result[$rowAmount - 1]; But this doesnt seem to work ! Can anyone help me out?
  18. just add an if clause for when $wc is entered it enters 'N/A' use a varchar(10) to store both string and ints Its something that works
  19. The first thing i came up with was the following : The code does not replace rij with its value, so i kinda need to use a function to call the value, i guess ...
  20. First my code was like this : Somewhere in my javascript code i call a function to disable some cells disableBlock2(true); Then this function is beïng called disabling the right fields. function disableBlock2(disableBool) { document.forms[0].B1A.disabled =disableBool; document.forms[0].B1B.disabled =disableBool; document.forms[0].B2A.disabled =disableBool; document.forms[0].B2B.disabled =disableBool; document.forms[0].uB1A.disabled=disableBool; document.forms[0].uB1B.disabled=disableBool; document.forms[0].uB2A.disabled=disableBool; document.forms[0].uB2B.disabled=disableBool; } I changed the code to a for - statement by using some arrays function disableBlock2(disableBool) { var rij = new Array('B1A','B1B','B2A','B2B','uB1A','uB1B','uB21','uB2B'); for(var i=0;i<rij.length;i++){ documents.forms[0].rij[i].disabled = disablebool; } } For a strange reason to me, the disabeling the fields doesnt work anymore. Anyone got a clue why? Im guessing somethings wrong in the use of my arrays ...
  21. I'll scream rape... Heh... the v flag wasn't even supposed to be there Humor i do not get ^^
  22. i found a program windows based that gave me those 2 options i want to get into more details now anyway thx for the advice this indeed works also
  23. LoL now u mentioned it, i totally scrambeld them in between But i guess he has more than 1 problem then I think he is looking for this $sql = "INSERT INTO officers (firstname,lastname) VALUES ($firstname,$lastname);" $result = mysql_query($sql);
  24. VALUES ('$_POST[firstname]','$_POST[lastname]') this is ur problem finding php variables trough the post methods is generally done by $_POST['firstname'] --> see the extra inside quotes This wont word to use single quotes inside single quotes ! SOLUTION $firstname = $_POST['firstname'] $lastname = $_POST['lastname'] then ur code will be VALUES ('$firstname','$lastname')
  25. And what do u mean by that? I am using a windows platform =) and got no clue what u mean by unix commands
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.