sasa
Staff Alumni-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Everything posted by sasa
-
change if (filesize($file)>60000) to if (filesize($file)<60000)
-
look http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html#function_if
-
Help displaying images in loop stored in mysql database row
sasa replied to bdarilek's topic in PHP Coding Help
create another script for pull images from database and pass to it key from database row -
try <?php $url = "https://remotedomain.com/api.php"; $url = parse_url($url); print_r($url); ?>
-
can you echo $i; after for loop
-
try <?php if(! empty($poll_title)) { $test = false; foreach($_POST['poll_questions'] as $key => $questions) { $poll_options = $_POST['poll_options'][$key]; foreach ($poll_options as $k => $v) if (empty($v)) unset($poll_options[$k]); if(empty($questions) or count($poll_options) < 3) { continue; } $test = true; $sql = "INSERT INTO poll_questions (question_text) VALUES('". $db->escape($questions) ."')"; $db->query($sql); $poll_id = $db->last_id(); foreach ($poll_options as $option){ $sql = "INSERT INTO poll_options (question_id, option_text) VALUES('". $poll_id ."', '". $option ."')"; $db->query($sql); } } if ($test){ $sql = "INSERT INTO polls (poll_title, topic_id) VALUES('$poll_title', $topic_id)"; $db->query($sql); $sql = "UPDATE topics SET has_poll = 1 WHERE topic_id = $topic_id"; $db->query($sql); define('META_REFRESH', "viewtopic.php?t=$topic_id&f=$forum_id"); trigger_error('poll_added'); } else echo 'poll not added'; } ?>
-
1st part of code create array $BlockOutput (try to print_r it), and 2nd insert this array in array $BlockArray with index 'Blocks'
-
where you add to db
-
google for ie6 margin bug
-
[SOLVED] simple string func not working correctly
sasa replied to scottybwoy's topic in PHP Coding Help
try <?php $products_description = "\" TESTING \""; echo trim($products_description, '"'); ?> -
change form to <form> tags etc here {QUESTION} 1: <input type="text" name="poll_questions[1]"/><br/> Option 1: <input type="text" name="poll_options[1][]"/><br/> Option 2: <input type="text" name="poll_options[1][]"/><br/> Option 3: <input type="text" name="poll_options[1][]"/><br/> Option 4: <input type="text" name="poll_options[1][]"/><br/> Option 5: <input type="text" name="poll_options[1][]"/><br/> Option 6: <input type="text" name="poll_options[1][]"/><br/> Option 7: <input type="text" name="poll_options[1][]"/><br/> Option 8: <input type="text" name="poll_options[1][]"/><br/> Option 9: <input type="text" name="poll_options[1][]"/><br/> Option 10: <input type="text" name="poll_options[1][]"/><br/> <br/> {QUESTION} 2: <input type="text" name="poll_questions[2]"/><br/> Option 1: <input type="text" name="poll_options[2][]"/><br/> Option 2: <input type="text" name="poll_options[2][]"/><br/> Option 3: <input type="text" name="poll_options[2][]"/><br/> Option 4: <input type="text" name="poll_options[2][]"/><br/> Option 5: <input type="text" name="poll_options[2][]"/><br/> Option 6: <input type="text" name="poll_options[2][]"/><br/> Option 7: <input type="text" name="poll_options[2][]"/><br/> Option 8: <input type="text" name="poll_options[2][]"/><br/> Option 9: <input type="text" name="poll_options[2][]"/><br/> Option 10: <input type="text" name="poll_options[2][]"/><br/> <br/> {QUESTION} 3: <input type="text" name="poll_questions[3]"/><br/> Option 1: <input type="text" name="poll_options[3][]"/><br/> Option 2: <input type="text" name="poll_options[3][]"/><br/> Option 3: <input type="text" name="poll_options[3][]"/><br/> Option 4: <input type="text" name="poll_options[3][]"/><br/> Option 5: <input type="text" name="poll_options[3][]"/><br/> Option 6: <input type="text" name="poll_options[3][]"/><br/> Option 7: <input type="text" name="poll_options[3][]"/><br/> Option 8: <input type="text" name="poll_options[3][]"/><br/> Option 9: <input type="text" name="poll_options[3][]"/><br/> Option 10: <input type="text" name="poll_options[3][]"/><br/>
-
try <?php while ($BlockCounter <= $NumBlocks) { $BlockName = 'Block' . $BlockCounter; $BlockFColor = $_POST[$BlockName . 'FColor']; $BlockINavYN = $_POST[$BlockName . 'INavYN']; $BlockDNavYN = $_POST[$BlockName . 'DNavYN']; $BlockTitle = $_POST[$BlockName . 'Title']; $BlockContent = $_POST[$BlockName . 'Content']; $BlockOutput[$BlockName]= array("FontColor" => "$BlockFColor", "INavYN" => "$BlockINavYN", "DNavYN" => "$BlockDNavYN", "Title" => "$BlockTitle", "Content" => "$BlockContent"); $BlockCounter++; } ?> and <?php $BlockArray = array("PageTitle" => "$PageTitle", "HeaderImage" => "$HeaderImage", "Introduction" => array("FontColor" => "$IntroColor", "Content" => "$IntroContent"), "NumberOfBlocks" => $NumBlocks, "Blocks" => $BlockOutput); ?>
-
try <?php $test = '<h1>Some tables and text</h1> <table> <tr> <th>England</th> <th>Paris</th> <th>Munich</th> </tr> <tr> <td> <table> <tr> <th>London</th> <th>Brighton</th> <th>Cambridge</th> </tr> <tr> <td>rain</td> <td>sun</td> <td>wind</td> </tr> </table> </td> <td>sun</td> <td>wind</td> </tr> </table> This is a text between the tables wich should not be removed. <table> <tr> <th>London</th> <th>Paris</th> <th>Munich</th> </tr> <tr> <td>rain</td> <td>sun</td> <td>wind</td> </tr> </table> This is a text after the tables which should also not be removed.'; $out = ''; $start = 0; $a = strpos($test, '<table'); $b = strpos($test, '</table'); $open_tag = 0; while ($a !== false or $b !== false){ if ($a < $b and $a !== false){ if ($open_tag == 0){ $out .= substr($test, $start, $a - $start); } $open_tag++; $a = strpos($test, '<table', $a + 1); } else { $open_tag--; $start = strpos($test, '>', $b+1) + 1; $b = strpos($test, '</table', $start); } } if ($open_tag) die('HTML error!'); $out .= substr($test, $start); echo $out; ?>
-
change if ($_GET["Page"] !="") to if (isset($_GET["Page"])) and so on. test isset($_GET) before you proces form btw. you dont have field with name 'Time' or 'time' in your form
-
fields in your forms are named 'Page', 'User Code' and 'Date'. You mast use same names in $_GET index
-
try <?php $count = mysql_num_rows($result); $count1 = 0; while($hey = mysql_fetch_array($result)){ echo $hey['firstname']; $count1++; if ($count1 == 2 and $count > 2){ echo "<a href=\"moreinfo.php\">[...]</a><br>"; break; } } echo '</td>'; ?>
-
<?php print($_SESSION['tmp_form']['error']); ?> change to <?php print(isset($_SESSION['tmp_form']['error']) ? $_SESSION['tmp_form']['error']) : ""; ?> btw. it isn't error it's notice
-
try to add space after "UPDATE" , change to "UPDATE " in 2nd $sql you have field name isx23
-
'/<a href="profile\.php\?[^"]*selected=([^"&]*)["&][^>]+><span[^>]+>([^<]*)</'
-
1st grab data and then count grabed rows @BioBob Format of LIMIT in MySQL is 'LIMIT start, lenght', not 'LIMIT start, end'
-
you dont pass $id thru your form change form to <?php include "db.php"; $id = $_GET[íd]; $select = mysql_query("select * from table where ID = '$id'"); $data = mysql_fetch_array($select); ?> <form method="post" ><input type="checkbox" name="publish" value="yes" <?php if($data['publish'] == 'yes'){ echo "checked='checked'"; } echo "<input type='hidden' name='id' value='$id' />" ?> /><input type="submit" name="submit"></form> and 2nd part to <?php if (isset($_POST['submit'])){ $publish = isset($POST[publish]) ? 'yes' : 'no'; $id = $_POST['id']; $query = mysql_query("UPDATE table SET publish = '$publish' WHERE ID = '$id'"); } ?>
-
you need ) in the end of query $q = "INSERT INTO moon (question, answer) VALUES('" . mysql_real_escape_string(stripslashes($_POST['question'])) . "', '" . mysql_real_escape_string(stripslashes($_POST['answer'])) . "')";
-
try <?php $current_page = 4; $totalpages = 6; $show = 5; $start = (int) max(1, min($current_page - floor(($show - 1)/2), $totalpages - $show + 1)); $end = min($totalpages, $start + $show - 1); $count = 0; for ($i = $start; $i <= $end; $i++) { if($current_page == $i) echo $i."\n"; else echo "<a href=?p=".$i."> ".$i." </a>\n"; } ?>
-
try <?php $width = 55; $a = '<table width="$width%">'; $a = addslashes($a); eval('$out = "'.$a.'";'); echo $out; ?>