sasa
-
Posts
2,804 -
Joined
-
Last visited
-
Days Won
1
Posts posted by sasa
-
-
you are in infinit loop
-
try
$embed = file_get_contents($stream_link); preg_match_all( '/"(http\:\/\/www\.megavideo\.com\/v\/[^"]*)"/i', $embed, $matches, PREG_SET_ORDER); foreach($matches[1] as $txt){ echo $txt.'<br />'; }
-
UPDATE table SET sort_order = sorto_urder + 1 WHERE sort_order >=4 ORDER BY sort_order DESC
and after insert row
-
preg_replace('/\s*\/\s*>/', '>', $subject)
-
<?php$test = 'ann+jokn';if(!preg_match('/[^a-z-]/', $test)) echo'OK';else echo'WRONG';?>
-
try
<?php mysql_connect('localhost', 'username', 'password'); //change to your username and password mysql_select_db('peterodc_selfbuild'); foreach ($_POST['materials'] as $mater){ $name = $mater['name']; //or is it $id (not sure... anyone more help) $material = $mater['material']; $stage = $mater['stage']; $unit = $mater ['unit']; // satanize inputs $sql = mysql_query("UPDATE materials SET material='$material', stage='$stage', quantity='$quantity',unit='$unit' WHERE id='$name'"); } ?>
-
-
<?php foreach ($_POST['materials'] as $mater){ $name = $mater['name']; //or is it $id $material = $mater['material']; $stage = $mater['stage']; //and so on // satanize inputs mysql_query("UPDATE table_name SET material='$material', stage='stage' etc. WHERE id='$name'"); } ?>
and add disabled="disabled" atribute to your input tag for id_number
-
change form to
<input id="<?php print $row['id'];?>" name="attendance[<?php print $row['id'];?>]" type="radio" value="1" checked="checked" /> <input id="<?php print $row['id'];?>" name="attendance[<?php print $row['id'];?>]" type="radio" value="2" /> <input id="<?php print $row['id'];?>" name="attendance[<?php print $row['id'];?>]" type="radio" value="3" />
all in one forrm
-
change
$thequery[] = mysql_query("UPDATE anime SET description = '".mysql_real_escape_string($new_description[$i])."', history='".mysql_real_escape_string($new_history[$i])."' WHERE anime_id='".$anime_id[$i]."'");
to
$thequery[] = "UPDATE anime SET description = '".mysql_real_escape_string($new_description[$i])."', history='".mysql_real_escape_string($new_history[$i])."' WHERE anime_id='".$anime_id[$i]."'";
-
try[code[<?php function my_replace($srch, $replace, $subject, $skip=1){ $subject = explode($srch, $subject.' ', $skip+1); $subject[$skip] = str_replace($srch, $replace, $subject[$skip]); while (($tmp = array_pop($subject)) == ''); $subject[]=$tmp; return implode($srch, $subject); } $test ='bla bla sasa bla bla sasa bla bla sasa'; echo my_replace('sasa', 'xxx', $test); echo "<br />\n"; echo my_replace('sasa', 'xxx', $test, 2); ?>
-
try to redirect page via heder after update database
btw. from where commas (,) come in variable $send_to?
-
change
if ($_GET["op"] == "login")
to
if (isset($_GET["op"]) and $_GET["op"] == "login")
-
you must select database bvefore use it
-
<?php function test_handleDropDowns($menuname, $userselectedoption) { if ($menuname == "ostype") { //start echoing the html code to create the dropdown menu echo "Operating System: <select name='ostype'>"; // Create drop down boxes. if ($userselectedoption == NULL) $userselectedoption = 'all'; $options = array('all' => 'All Types', 'windows' => 'Windows', 'linux' =>'Linux'); foreach ($options as $v => $option) echo "<option value='$v'", ($v == $userselectedoption) ? " selectede='selected'" : "",">$option</option>"; echo "</select>"; } } ?>
-
are you try this
<?php $hostSignIn0001="server1"; $userSignIn0001="xxx1"; $passwordSignIn0001="yyy1"; $dbnameSignIn0001="zzz1"; $hostSignIn0002="server2"; $userSignIn0002="xxx2"; $passwordSignIn0002="yyy2"; $dbnameSignIn0002="zzz2"; $site = 2; $site = str_pad($site, 4, '0', STR_PAD_LEFT); $host = ${'hostSignIn'.$site}; $user = ${'userSignIn'.$site}; echo "$host, $user"; ?>
-
$team_select = "SELECT *, @rank := IF(@points=points, @rank, @rank+1), @points:=points FROM (SELECT t.team_id, t.team_name, COUNT(r.league_match_result_id) AS 'matches_played', SUM(IF(r.result='Win',1,0)) AS `wins`, SUM(IF(r.result='Loss',1,0)) AS `losses`, SUM(IF(r.result='Draw',1,0)) AS `draws`, SUM(IF(r.result='Win',3,IF(r.result='Draw',1, IF(r.result='Loss',0,0)))) AS `points` FROM teams t LEFT JOIN league_match_results r ON r.team_id = t.team_id LEFT JOIN team_leagues tl ON tl.team_id = t.team_id RIGHT JOIN league_matches m ON r.league_match_id = m.league_match_id WHERE tl.league_id = :1 GROUP BY t.team_id ORDER BY points, team_name) AS x";
-
try
<?php // Connects to your Database mysql_connect("**", "**", "**") or die(mysql_error()); mysql_select_db("loginwatsonn") or die(mysql_error()); echo "Start"; echo "<br>"; $result = mysql_query(sprintf("SELECT * FROM Logins WHERE UID = %d", $_COOKIE['UID_WatsonN'])); //check login table against cookie if(($num = mysql_num_rows($result)) > 0){ mysql_close(); ?> <table border="0" cellspacing="2" cellpadding="2"> <tr> <th>ID</th> <th>UID</th> <th>Site</th> <th>Uname</th> <th>Pass</th> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"ID"); $f2=mysql_result($result,$i,"UID"); $f3=mysql_result($result,$i,"Site"); $f4=mysql_result($result,$i,"Uname"); $f5=mysql_result($result,$i,"Pass"); ?> <tr> <td><?php echo $f1; ?></td> <td><?php echo $f2; ?></td> <td><?php echo $f3; ?></td> <td><?php echo $f4; ?></td> <td><?php echo $f5; ?></td> </tr> <?php $i++; } } ?>
-
look in_array($needle, $haystackarray); function
-
ctype_alnum()
-
SELECT COUNT(p.*) AS total_entries FROM mod_posts AS p LEFT JOIN mod_cat AS c ON c.categoryID = p.articleCat WHERE p.articlePosted =1 AND c.isPrivate != 1
-
are you try this query
i'm just copy your query and i don't see tha you use ' instead ` change this
$team_select = "SELECT @rank := @rank + 1 AS `rank`, t.team_id, t.team_name, COUNT(r.league_match_result_id) AS `matches_played`, SUM(IF(r.result='Win',1,0)) AS `wins`, SUM(IF(r.result='Loss',1,0)) AS `losses`, SUM(IF(r.result='Draw',1,0)) AS `draws`, SUM(IF(r.result='Win',3,IF(r.result='DRAW',2,0))) AS `points` FROM teams t LEFT JOIN league_match_results r ON r.team_id = t.team_id LEFT JOIN team_leagues tl ON tl.team_id = t.team_id RIGHT JOIN league_matches m ON r.league_match_id = m.league_match_id WHERE tl.league_id = 1 GROUP BY t.team_id ORDER BY team_name";
this line 'SUM(IF(r.result='Win',3,IF(r.result='Draw',2,0))) AS `points`' means
if result is Win use 3 else if result is Draw use 2 else use 0 and sum this number
btw. DRAW != Draw
-
<?php$test = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.<img alt="something" src="http://www.somesite.com/images/image1.jpg" style="width: 400px; height: 300px;" />Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco<img alt="something" src="http://www.somesite.com/images/image2.jpg" style="width: 400px; height: 300px;" />Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco';$out = preg_replace('~<img [^>]*src="(http://([^"/]+)[^"]+)"[^>]*>~', '<img alt="$2" src="http://www.site.com/phpthumb.php?$1?w=400" />', $test);echo $out;?>
-
try
<?php foreach ($_POST['m_name'] as $key => $value) if($key % 2 == 0) $tmp = "('$value', "; else $out[] = $tmp."'$value[email]')"; $sql = "INSERT INTO table name (name,email) ". implode(', ', $out); ?>
Is This Possible?
in PHP Coding Help
Posted
pseudo code