fugix
-
Posts
1,483 -
Joined
-
Last visited
Posts posted by fugix
-
-
so you want to keep everything but the last number on the end?
-
echo $row['city_name']; ?
-
I was thinking the same as Pikachu2000.
Basically, if I have $array1. And it has 5 values.
I want to loop through these values in a RANDOM order but retain their order in $array1.
So as Pikachu2000 stated, making a copy of the array to say $array2, shuffling it and then looping through it (not necessarily echoing anything) would work as then I can return to $array1 with everything preserved in the correct order.
I just want to know if there is a simpler way..
there are other ways to do it, but as far as simplicity is concerned, the example that Pikachu2000 provided is what you want
-
...you can use a localhost to do this which is free
Your use of terminology will cause confusion. A "localhost" is not a webserver. Every machine has a "localhost" it is simply an internal domain name pointing the machine back to itself. When you use localhost in the URL you are simply making an http (usually) request back to the pc itself. It is no different than using the machines name or IP address. For example you can ping a cmputer back to itself using localhost even if it has no web server installed. And, you can have a webserver (which uses localhost) which is not free.
yes sorry if my wording caused confusion...thanks for clearing that up mjd
-
welcome to phpf..
-
yes you can simply google xampp or localhost server to find many sites that direct you on how to set it up..
-
you will need to have a server to run php script since it communicates with the server...you can use a localhost to do this which is free
-
so you've tried something like
<?php if( isset( $_COOKIE[$cname] ) ) { var_dump($_COOKIE ); } else { echo "doesnt exist!"; } ?>
?
-
if you want to grab the value of what a user is typing in, while they are typing it in...you will most likely want to use AJAX. unless you are talking about after the input is submitted? after adding the third field...no error occur, the script simply does not work?
-
Can use preg_match() to single out the number in the file them echo it
-
Do you want to loop through them randomly or simply echo them randomly. Perhaps if I more clearly understood what you are trying to do
-
I think he's wondering if the variable is overwritten somewhere in your code. Why don't you try echoing the session itself in the footer instead of assigning it to a variable and then echoing it?
-
what error(s) exactly are you receiving? also the first error that i see is in this line
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION[branch]' ");
need to add quotes in your session e.g
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION['branch']' ");
That line was fine the way it was. The code you offered will produce: Parsing Error: /htdocs/test.php line 105 - syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
@ OP
Regarding the following line, I don't see where $Serviceamount['item'] would ever get a value in the code you posted.
$Serviceamount = $Serviceamount['item'];
Do you have
error_reporting = -1
-and-
display_errors = On
in your php.ini file while you're doing development?
his original code would have caused that error due to the session in the query..i simply appended or die() on the end
No the OP's code wouldn't have caused that error. You added quotes in the array index, and the error I posted was copied and pasted after running the actual code with the edit you posted.
okay, problem was solved....moving on
-
ahhh thank you very much right the errors i get are before the button is clicked
Notice: Undefined index: id in /var/www/Newkpi.php on line 12
and once the button is clicked i get
Fatal error: Call to undefined function check_input() in /var/www/Newkpi.php on line 28
which would explain why its not inserting
now solved i got rid of that function and it worked
thank you to everyone especially fugix and Pikachu2000 who helped alot with my debugging problem
glad we could help you
-
what error(s) exactly are you receiving? also the first error that i see is in this line
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION[branch]' ");
need to add quotes in your session e.g
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION['branch']' ");
That line was fine the way it was. The code you offered will produce: Parsing Error: /htdocs/test.php line 105 - syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
@ OP
Regarding the following line, I don't see where $Serviceamount['item'] would ever get a value in the code you posted.
$Serviceamount = $Serviceamount['item'];
Do you have
error_reporting = -1
-and-
display_errors = On
in your php.ini file while you're doing development?
his original code would have caused that error due to the session in the query..i simply appended or die() on the end
-
to check if it is a mysql error you can kill the script upon receiving an error and print the error e.g
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION[branch]' ") or die(mysql_error());
try to debug your queries and let us know your results
-
what error(s) exactly are you receiving? also the first error that i see is in this line
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION[branch]' ");
need to add quotes in your session e.g
$stafflist = mysql_query("SELECT * FROM StaffList WHERE full_name != 'Adam Carter' AND full_name != 'Jakata' AND branch = '$_SESSION['branch']' ");
-
using the code that coolcam provided, the only way that the code wouldn't work is if your num_rows does not equal 0
-
said one phrase in spanish and i get hounded..voca is a word...its puerto rican slang...im not being an "idiot troll"..is offensive though
Slang aren't formal words. You did not get hounded, I asked you politely.
if i was having an entire conversation in spanish i would understand why you would intercede..however i said two words to another member that was not yourself..not sure why you felt the need to write what you did but i'll drop it because its not a big deal.sorry for writing in spanish, will never happen again
-
said one phrase in spanish and i get hounded..voca is a word...its puerto rican slang...im not being an "idiot troll"..is offensive though
-
1) Because boca means mouth, not voca, and I don't even think voca is a word.
2) I said so.
sounds racist to me
-
It's boca, not voca, and please keep this forum to English.
why?
-
Thanks
I wish this forum had LIKES/THANKS and reputation points
Im presently working on a PHP website that has CSS and javascript... And am a programmer analyst by trade..
good to have some more experience here then!
-
Thank you, thank you, thank you!
It worked!
excellent
assigning a session to a variable , twice!?
in PHP Coding Help
Posted
excellent. please mark as solved on the bottom left of this thread.. thanks