jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
I don't understand why you can't define the variables, then include the heredoc. Which would parse all of the variables that have been defined.
-
Variables are parsed in double quoted strings, no need to do that. Swap your lines around: // The message $email = $row_user_data_RS['cliente_email']; $password = $row_user_data_RS['cliente_password']; $message = "Dear client,\n your access details are:\n Usr Name:'$email'\n Password:'$password'"; Variables are looked at in an ordered fashion. So you must declare and then use, you cannot use then declare.
-
cant assign time to a session variable using date()??
jcbones replied to spryce's topic in PHP Coding Help
have you dumped the $_SESSION array? echo '<pre>'; print_r($_SESSION); echo '</pre>'; -
We could help out with more detailed info, if we seen some code.
-
You shouldn't put quotes around the column name. $k1D = mysql_real_escape_string($_POST['dates']); $kol = mysql_real_escape_string($_POST['exams']); mysql_query(" UPDATE studenti SET $kol = '$k1D' WHERE ID = '3'");
-
Whats the error in this Insert Statement...???
jcbones replied to genext.brite's topic in PHP Coding Help
The insert statement will not cause an error, because it is never sent to the Database. You must use mysql_query($sql) to do that. -
browser detection to just show, Internet Explorer, Safari, Firefox, etc.
jcbones replied to brem13's topic in PHP Coding Help
If your host has browscap enabled, you could use get_browser() to do it. Otherwise, you could use search google. If you did that, I would suggest the 4th or 5th link. -
Format accepted by the DateTime class: (sorry about the formatting, forums can mess up columns pretty good.) Description Format Examples American month and day mm "/" dd "5/12", "10/27" American month, day and year mm "/" dd "/" y "12/22/78", "1/17/2006", "1/17/6" Four digit year, month and day with slashes YY "/" mm "/" dd "2008/6/30", "1978/12/22" Four digit year and month (GNU) YY "-" mm "2008-6", "2008-06", "1978-12" Year, month and day with dashes y "-" mm "-" dd "2008-6-30", "78-12-22", "8-6-21" Day, month and four digit year, with dots, tabs or dashes dd [.\t-] mm [.-] YY "30-6-2008", "22.12\t1978" Day, month and two digit year, with dots or tabs dd [.\t] mm "." yy "30.6.08", "22\t12\t78" Day, textual month and year dd ([ \t.-])* m ([ \t.-])* y "30-June 2008", "22DEC78", "14 III 1879" Textual month and four digit year (Day reset to 1) m ([ \t.-])* YY "June 2008", "DEC1978", "March 1879" Four digit year and textual month (Day reset to 1) YY ([ \t.-])* m "2008 June", "1978-XII", "1879.MArCH" Textual month, day and year m ([ .\t-])* dd [,.stndrh\t ]+ y "July 1st, 2008", "April 17, 1790", "May.9,78" Textual month and day m ([ .\t-])* dd [,.stndrh\t ]* "July 1st,", "Apr 17", "May.9" Day and textual month d ([ .\t-])* m "1 July", "17 Apr", "9.May" Month abbreviation, day and year M "-" DD "-" y "May-09-78", "Apr-17-1790" Year, month abbreviation and day y "-" M "-" DD "78-Dec-22", "1814-MAY-17" Year (and just the year) YY "1978", "2008" Textual month (and just the month) m "March", "jun", "DEC" What this tells you is that if you are going to use a 2 digit year, you can separate the day month and year with dots(.) or tabs. Otherwise, you can separate with dots(.),tabs, or dashes(-) if you use a 4 digit year.
-
I never thought about that, Ken. Although, I can see how that would work. My post was made to late at night. ,with the opinion that the OP needs to rethink how AJAX works.
-
Upload success at localhost but not in server.please help.....
jcbones replied to new_php85's topic in PHP Coding Help
Nothing in your form is named 'xtvt', nor valued as 'addEdit'. -
PHP does NOT reside in a table, or any other element for that matter. IT is strictly server side. Ajax MUST submit the form to a PHP page, then retrieve the results. You should put your PHP code in a separate file, and send the ajax request to that file. You then use javascript to populate the #rest table, then you show that table on the page. Simply hiding the table on page load, and then requesting to show it, will not show the appropriate table, because you haven't chosen the gender yet. In order for AJAX to work, you MUST separate the scripts, you cannot call half a page from the server.
-
Yes, as the included file is not fetched via HTTP. If your .htaccess file is a deny/all, then it will drop all HTTP request.
-
Upload success at localhost but not in server.please help.....
jcbones replied to new_php85's topic in PHP Coding Help
Where is your form? -
You missed a closing ) in the sql statement. This is the importance of assigning the query string to a variable, and then the variable to the query. <?php $username = $_SESSION['username']; $id = $_SESSION['id']; $query = "SELECT * FROM users WHERE username NOT IN (SELECT friend_username FROM friends WHERE my_id = '$id')"; $sql = mysql_query($query) or trigger_error($query . ' has an error:<br />' . mysql_error()); while($row = mysql_fetch_assoc($sql)){ ?> <table> <tr><td> <?php echo $row['username']; ?> </td></tr> <tr><td> <form action="add.php?id=<?php echo $row['id']; ?>" method="POST"> <input type="submit" name="i" value="Add"> </form> </td></tr></table> <?php }
-
You could run your input through htmlentities(). Which will show all elements in plain text on the screen. Thereby they will not execute. In the event that you wish to let users format their own text, you should use BBCode. This is the main reason it was written.
-
Can someone explain this PHP+XML code to me?
jcbones replied to pahunrepublic's topic in PHP Coding Help
Because arrays start at index 0, so if the array count is 15, your highest index will be 14. -
Can someone explain this PHP+XML code to me?
jcbones replied to pahunrepublic's topic in PHP Coding Help
$x->length-1 //subtract 1 from the $x->length, which is the amount of nodes in your object. Node types are: NodeType Named Constant 1 ELEMENT_NODE 2 ATTRIBUTE_NODE 3 TEXT_NODE 4 CDATA_SECTION_NODE 5 ENTITY_REFERENCE_NODE 6 ENTITY_NODE 7 PROCESSING_INSTRUCTION_NODE 8 COMMENT_NODE 9 DOCUMENT_NODE 10 DOCUMENT_TYPE_NODE 11 DOCUMENT_FRAGMENT_NODE 12 NOTATION_NODE -
You did put the appropriate id number in 'my_id' didn't you? You could also try: SELECT * FROM users WHERE username NOT IN (SELECT friend_username FROM friends WHERE my_id = '1');
-
With no more info than you have given, I would suggest that you use: SELECT users.* FROM friends JOIN users ON friends.username != users.username WHERE friends.my_id = 'my_id';
-
help with different colours per line for shopping cart type script
jcbones replied to echoCarlos's topic in PHP Coding Help
$class = 'grey'; <?php foreach(getItems() as $item): ?> <?php $class = ($class == 'grey') ? 'grey2' : 'grey'; ?> <tr class="<?php echo $class; ?>"> <td><?php echo $item['item_account']; ?></td> <td><?php echo $item['item_country']; ?></td> <td><?php echo $item['item_info']; ?></td> <td><?php echo $item['item_login']; ?></td> <td><?php echo $item['item_pass']; ?></td> <td><?php echo $item['item_price']; ?> </td> <td><form method="post" action="#"><input type="submit" name="buy" value="Buy" class="button" /></form></td> </tr> <?php endforeach; ?> I think that's right. -
How do you echo date functions on certain times of the day??
jcbones replied to harryuk's topic in PHP Coding Help
$time = date('G'); if(($time == '1') || ($time > '1' && $time < '12')) { echo 'Good morning!'; } elseif(($time == '12') || ($time > '12' && $time < '18') { echo 'Good afternoon!'; } else { echo 'Good night!'; } -
What does this function return? function updateCandidate($id, $F_Name, $L_Name, $Gender, $Bday, $PhoneNo, $Address, $City, $Country, $Nationality, $experience, $Stat) { $q = "UPDATE candidates SET F_Name = '$F_Name', L_Name='$L_Name', Gender='$Gender', Bday='$Bday', PhoneNo='$PhoneNo', Address = '$Address', City='$City', Country = '$Country', Nationality = '$Nationality', Experience_idExperience='$experience', Status= $Stat WHERE Users_UsersID = $id"; if(mysql_query($q, $this->connection)) { return true; } else {echo $q . ' has encountered an error<br />' . mysql_error(); return false; } }
-
Have you tried the dateTime class? <?php $datetime1 = new DateTime('2010-12-13 23:00'); $datetime2 = new DateTime('2010-05-27 00:00'); $interval = $datetime2->diff($datetime1); echo $interval->format('%R%a days %h:%i:%s'); //%a is broken on Windows servers. You will have to use years, months, and days. ?> Manual
-
Godaddy doesn't use cpanel.
-
When all else fails, check for expected data. echo '<pre>'; print_r($_FILES); echo '</pre>';