PHP - Help With If Else Kindly.
Hi here is my statement
<?php $qid=$_GET['qid']; require_once('database_connect.php'); $answer = "SELECT answers.* FROM answers WHERE aid ='$qid'"; $resulta=mysql_query($answer) or die (mysql_error()); while ($rowa=mysql_fetch_assoc($resulta)) { $aid=$rowa['aid']; $answer=$rowa['answer']; $info_rows = mysql_num_rows($resulta); if($info_rows > 0) {echo "$answer";}else {echo "be the first to answer this question";} ;} ?> the IF part is working fine but the else isnt displaying anything at all. Could you kindly tell me, what am i doing wrong and lastly this statement is in a while loop. Similar TutorialsHi.. can somebody out there can help me. im totally frustrated and im googling crazy. can somebody tell me the right configuration of php and mysql to upload more than 1mb file size and store it in a mysql database. my script works fine and it only can upload less than 1mb files size. can somebody give me the right configuration? Following is the code that works fine if I am passing `/pageid/feed` to `facebook->api`, but when I change it to upload the image directly to my Facebook FAN PAGE photo album, it will not work. Kindly let me know what I am doing wrong in the following code: // Works fine $status = $facebook->api("/406221796071956/feed", 'post', $attachment); // Does not work $status = $facebook->api('/196878530339618/photos', 'post', $attachment); # Full Source Code: [Select] <?php require 'src/facebook.php'; $app_id = "364900470214655"; $app_secret = "xxxx"; $facebook = new Facebook(array( 'appId' => $app_id, 'secret' => $app_secret, 'cookie' => true, 'fileUpload' => true, )); $user = $facebook->getUser(); if(($facebook->getUser())==0){ header("Location:{$facebook->getLoginUrl(array('req_perms' => 'photo_upload,user_status,publish_stream,user_photos,offline_access,manage_pages'))}"); exit; } else { $accounts_list = $facebook->api('/me/accounts'); echo "i am connected"; } $valid_files = array('image/jpeg', 'image/png', 'image/gif'); // To get the page access token to post as a page foreach($accounts_list['data'] as $account){ if($account['id'] == 194458563914948){ // my page id =123456789 $access_token = $account['access_token']; echo "<p>Page Access Token: $access_token</p>"; } } // Posting to the page wall if(isset($_FILES) && !empty($_FILES)){ $folder = "pak/".$_FILES['pic']['name']; // Getting the path of the folder $fold = 'http://radiations3.com/facebook/'.$folder; // URL Path to folder echo $fold."<br>"; if(move_uploaded_file($_FILES['pic']['tmp_name'], $folder)){ # Upload photo here $img = realpath($_FILES["pic"]["tmp_name"]); $album_id = '406221796071956'; $attachment = array( 'message' => $_POST['textfield'], 'source' => $fold, 'aid' => $album_id, 'no_story' => 1, 'access_token' => $access_token ); $status = $facebook->api("/196878530339618/photos", 'post', $attachment); } else{ echo 'Only jpg, png and gif image types are supported!'; } } ?> <body> <!-- Form for uploading the photo --> <div class="main"> <p>Select a photo to upload on Facebook Fan Page</p> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data"> <p>Select the image: <input type="file" name="pic" /> <br /> <label>Description <input type="text" name="textfield" id="textfield" /> </label> </p> <p><input class="post_but" type="submit" value="Upload to my album" /></p> </form> </div> </body> How can i call javascript function from php code?? (Kindly Help) As an example (idea) Code: [Select] <script language="javascript"> function divclose() { alert("I am an alert box!"); } </script> <? echo "<SCRIPT LANGUAGE='javascript'>divclose();</SCRIPT>"; ?> |