[Solved] Condition inside table [closed]

Do you mean something like the following? echo ‘<td>’ . ($data[‘temperature’] < 5 ? ‘Cold’ : ‘Warm’) . ‘</td>’; The above uses the ternary operator as a contracted if/else within a table cell. 1 solved Condition inside table [closed]

[Solved] How to read a file line by line in PHP

I assume you need a way to make it more dynamic than manually typing [0] then [1] and so on? You can loop the txtfile with foreach and assign new array items with []. $file = fopen(“path of txt”); foreach($file as $line){ $numDoc[] = substr($line, 46, 5); $dateDoc[] = substr($line, 30, 8); } The code … Read more

[Solved] Just using mysql real escape string [closed]

it is not working … the strings like />., still can be enter in the sql database It is working. mysql_real_escape_string is a function that escapes characters which have special meaning in SQL. / and > do not have special meaning in SQL, so it shouldn’t touch them. If they did have special meaning, then … Read more

[Solved] imagepng() expects parameter 1 to be resource [closed]

Read the manual! You have to first obtain an image resource, returned by one of the image creation functions, such as imagecreatefrompng(): $file = $PNG_WEB_DIR.basename($filename); $img = imagecreatefrompng($file); // … ob_start(“output_handler”); imagepng($img,NULL,9); $image_data = ob_get_contents(); ob_end_flush(); 4 solved imagepng() expects parameter 1 to be resource [closed]

[Solved] php variable changes when clicked on html link [closed]

Try this, is PHP: <?php if (isset($_GET[‘money’])) { $money = rob_shop($_GET[‘money’]); echo ‘You now have: ‘.$money.'<br>’; } else { $money = 100; echo ‘You now have: ‘.$money.'<br>’; } echo ‘<a href=”https://stackoverflow.com/questions/27303586/?money=”.$money .'”>rob a shop</a>’; function rob_shop($money){ $money = $money + 75; return $money; } ?> But the best way to do it is with ajax … Read more

[Solved] ( ! ) Parse error: syntax error, unexpected ‘}’ in C:\wamp\www\mybbeklents\rapor\gonder.php on line 11 [duplicate]

You are missing semicolons: if($ad==””){header(“location:index.php?kls=1″);}else {if($email==””){header(“location:index.php?kls=2″);}else {if($mesaj==””){header(“location:index.php?kls=3″);}else {if($kiriklink==””){header(“location:index.php?kls=4”);}else {mysql_query(“INSERT INTO bildirim (`ad`,`email`,`acklama`,`kiriklink`,`tarih`) VALUES (‘$ad’,’$email’,’$mesaj’,’$kiriklink’,now())”);header(“location:index.php?kls=5″);}}}} Btw. if you don’t use, then you should start using some IDE like netbeans or phpdesigner, it will show you where error is NEW CODE: if($ad==””){header(“location:index.php?kls=1″);}else {if($email==””){header(“location:index.php?kls=2″);}else {if($mesaj==””){header(“location:index.php?kls=3″);}else {if($kiriklink==””){header(“location:index.php?kls=4”);}else { $query = “INSERT INTO bildirim (`ad`,`email`,`acklama`,`kiriklink`,`tarih`) VALUES (‘$ad’,’$email’,’$mesaj’,’$kiriklink’,now())”; $result = mysql_query($query); … Read more

[Solved] What language should i use for dynamic client side and server side form validation? [closed]

Easiest option for me, is to learn PHP for server-side validation. If you want to add client-side validation (which is not a “MUST”, but is a “PLUS”), you can use Javascript. Avoid using Ajax, jQuery or any kind of advanced libraries and functionalities until you get a basic understanding of what happens where. 4 solved … Read more

[Solved] How to find number of variables passed in function in php [closed]

Now there is another function xyz in want to know number of variables that are need to be passed in this function. Use this: $rfunc = new ReflectionFunction(‘xyz’); echo $rfunc->getNumberOfRequiredParameters(); But I do not know for what this should be useful… 3 solved How to find number of variables passed in function in php [closed]

[Solved] How to use DEFINE vars inside functions

The scope of a constant is already global, so just use them as they are: define(‘VAR1’, ‘xxxxxxxxxx’); define(‘VAR2’, ‘xxxxxxxxxx’); define(‘VAR3’, ‘xxxxxxxxxx’); function myFunction() { echo VAR1; // I need to access VAR1, VAR2, VAR3 here } $output = myFunction(); 1 solved How to use DEFINE vars inside functions

[Solved] Block your website to be visible on phones

Thank god not much people know about weinre. You can use @media queries to detect the screen size and remove the contents accordingly. @media (max-device-width: 1024) { body { display: none; } } The max-device-width works only on devices and not on desktops. This is a way of doing using CSS. In JavaScript, well, I … Read more