Jump to content

Search the Community

Showing results for tags 'boolean'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 11 results

  1. Need some pointers. User (usr), Application (app), and Permission (acs) tables. Need an SQL to ascertain access levels for read, modify, and admin.. A record in asc is NOT guaranteed! in the app table for example if ap_read = 1 then we need not a record in acs to read whatever is there. If however it was 0 we would need a record in asc with read = 1 for that app/usr combo I currently open and query these three separately, and it works, but there has to be a more elegant way. not EXACTLY normalized.. I guess. I hope the question is descriptive enough.
  2. Hi there, I have a simple question to ask: Say i have a PHP script: <?php var_dump($undeclaredVariable); /* The output is NULL */ if($a==$b) { if($c == $d) { $undeclaredVariable = TRUE; } else { $undeclaredVariable = FALSE; } } if($undeclaredVariable == TRUE) { echo 'the undeclared variable is TRUE'; } if($undeclaredVariable == FALSE) { echo 'the undeclared variable is FALSE'; } ?> Reading the PHP Type Comparison Table: $x = null; boolean if($x) = FALSE Using the code above, I see the "the undeclared variable is FALSE", which is OK since it proves the PHP documentation. But as you can see, if $a !=$b then the $undeclaredVarable will not be declared(defined). Is this an "OK" way to work this out? Or should I find a way to declare the variable whatever the case? Thanks in advance, Christos
  3. <?php $select="SELECT distinct province FROM property WHERE country = '$country' order by province asc "; $results = mysql_query("$select", $link_id); if(mysql_num_rows($results)>0){ while ($query_data = mysql_fetch_row($results)) { $theprovince=$query_data[0]; if(trim($theprovince==""))continue; $theprovince=stripslashes($theprovince); $total_results2 = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM property WHERE province = '$theprovince' "),0) ; echo "<li><a href=\"houses.php?province=$theprovince&country=$country\" title='$theprovince $country'>$theprovince ($total_results2)</a></li>\n"; } } ?> PHP Warning: mysql_result() expects parameter 1 to be resource, boolean given in public_html/province.php on line 11 Hi, can anyone please advise as I keep getting this error message on this code and its driving me mad. Many thanks
  4. <?php include('Connect.php'); $query ="SELECT * From Section order by sectCode ASC"; $result = mysql_query($query); mysql_close($con); $ctr = 0; echo" <body> <TABLE valign = top align = center border = 0 width =85% cellpadding = 2 cellspacing = 0 bgcolor = aliceblue> <tr><th colspan = 5 align = center>List of Classes <tr><td colspan =5><hr> <tr><th bgcolor = white align = left> <th bgcolor = white align = center><font color =black>Section <th bgcolor = white align = center><font color =black>Subject Code <th bgcolor = white align = center><font color = black>Subject Description <th bgcolor = white align = center><font color = black>Time/Day <tr><td colspan =5><hr>"; $ctr = 1; while ($rec = mysql_fetch_row($result)) { echo" <tr> <td align = center>$ctr <td>$rec[1] <td>$rec[2] <td>$rec[3] <td>$rec[4] </tr>"; $ctr++; } $ctr; echo "<tr><td colspan=5><hr>Total no. of SectionsPrinter: $ctr <tr><td colspan=5><hr> </table> </body>"; ?>
  5. I keep running into this problem on a few of my scripts now. I am putting together a signup and login form. (i know basic stuff). I have managed to create the signup and it is inserting and displaying information from my database and table. I can successfully connect as well. The warning that I am getting is : Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/content/80/11355280/html/login.php on line 30 Line 30 is BOLD mysql_connect("$host", "$username", "$password");mysql_select_db("$db_name"); $wcdname=mysql_real_escape_string($_POST['wcdname']); $pword=mysql_real_escape_string($_POST['pword']); $sql="SELECT * FROM $tbl_name WHERE username='$wcdname' and password='$pword'"; $result=mysql_query($sql); $count=mysql_num_rows($result); if($count==1){ session_register("wcdname"); session_register("pword"); (line 30) header("location:login_complete.html"); } else { echo "Wrong Username or Password"; } ?> If I change anything on line 30 It gives me the same warning but jumps back to line 26. It is displaying the ELSE echo for Wrong Username and Password. However the username and password is correct. I am having the same problem on a few other scripts I am trying. I have also had a problem with the way I was connecting. Im not sure if its best to define the variables or to just make a connection without them. I dont know if that could be the reason I am getting an error as well. I am registered through godaddy. Thank you if you can help me, sorry for being a noob.
  6. I've got a form that lets the user submit, or update a record, matching the update to the previously entered E-Mail. However, there is a "Do Not Contact" option that I need to be able to update as well. Here is how I have it structured: elseif (isset($_POST['Update'])){ $parentOneFirstName = mysqli_real_escape_string($dbcon, $_POST["parentOneFirstName"]); $parentOneLastName = mysqli_real_escape_string($dbcon, $_POST["parentOneLastName"]); $parentTwoFirstName = mysqli_real_escape_string($dbcon, $_POST["parentTwoFirstName"]); $parentTwoLastName = mysqli_real_escape_string($dbcon, $_POST["parentTwoLastName"]); $homePhone = mysqli_real_escape_string($dbcon, $_POST["homeNumber"]); $cellPhone = mysqli_real_escape_string($dbcon, $_POST["cellNumber"]); $city = mysqli_real_escape_string($dbcon, $_POST["city"]); $state = mysqli_real_escape_string($dbcon, $_POST["state"]); $zipPostal = mysqli_real_escape_string($dbcon, $_POST["zipPostal"]); $emailAddress = mysqli_real_escape_string($dbcon, $_POST["emailAddress"]); $referringFacility = mysqli_real_escape_string($dbcon, $_POST["referringFacility"]); $preferredContact = mysqli_real_escape_string($dbcon, $_POST["preferredContact"]); // $doNotContact = mysqli_real_escape_string($dbcon, $_POST["doNotContact"]); $sql = "UPDATE tbl_parentinformation SET emailAddress = '$emailAddress'"; if(!empty($parentOneFirstName)) $sql = $sql . ",parentOneFirstName = '$parentOneFirstName'"; if(!empty($parentOneLastName)) $sql = $sql . ",parentOneLastName = '$parentOneLastName'"; if(!empty($parentTwoFirstName)) $sql = $sql . ",parentTwoFirstName = '$parentTwoFirstName'"; if(!empty($parentTwoLastName)) $sql = $sql . ",parentTwoLastName = '$parentTwoLastName'"; if(!empty($homeNumber)) $sql = $sql . ",homePhone = '$homePhone'"; if(!empty($cellNumber)) $sql = $sql . ",cellPhone = '$cellPhone'"; if(!empty($city)) $sql = $sql . ",city = '$city'"; if(!empty($state)) $sql = $sql . ",state = '$state'"; if(!empty($zipPostal)) $sql = $sql . ",zipPostal = '$zipPostal'"; if(!empty($referringFacility)) $sql = $sql . ",referringFacility = '$referringFacility'"; if(!empty($preferredContact)) $sql = $sql . ",preferredContact = 'preferredContact'"; $sql = $sql . "WHERE emailAddress = '$emailAddress'"; This allows the user to update only fields they need to update, and doesn't empty out the data already there. The boolean value is received from a checkbox (check = true, nocheck = false), but I can't get it to check to see if it needs to update or not. Anyone have this problem in the past? I want them to have the OPTION to update it, but not require them to check each time a record is updated. Thanks in advance to anyone that responds
  7. I'm a little new to PHP, a little more familiar to SQL but I haven't been able to figure out how to send a boolean value from an html form to the SQL server. I've got the doNotContact in the database as a boolean value, and have a checkbox for the selection: <td>Do Not Contact: </td><td><input type="checkbox" name="doNotContact" value= "True"/></td><br /> But when I write the SQL statement, it fails to get a value. All other values (text/number) work perfectly, except for this, so if anyone has any suggestions - I would appreicate it.
  8. i have found warning message = Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given inC:\xampp\htdocs\articles\artikel.php on line 7 <?php include 'koneksi.php'; $articleid = $_GET['articleid']; $sql_query = 'SELECT ta.*, tca.category_article FROM article_news AS ta INNER JOIN tcategory_article AS tca ON ta.category_article_id = tca.category_article_id WHERE article_id = '.$articleid; $query = mysql_query($sql_query); $row = mysql_fetch_array($query); //--> this is line #7 $msg = $_GET['msg']; if(!empty($msg)){ if($msg = 100){ echo '<h5 style="text-align:center; color:#f00; font-weight: normal">.</h5>'; } } ?> <!--articles--> <a name="TemplateInfo"></a> <input type="hidden" name="prodid" value="<?php echo $row['article_id'];?>" size="1"/> <h1><?php echo $row['judul'];?></h1> <p><a href=""><img src="images/upload/<?php echo $row['photo'];?>" width="100" height="120" class="float-left"></a> <p><?php echo $row['artikel'];?></a>. </p> <!--end of articles--> <p><?php echo $row['category_article'];?></p> <p class="post-footer"> <a href="index.html" class="readmore">Read more</a> <a href="index.html" class="comments">Comments (7)</a> <span class="date"><?php echo $row['tanggal'];?></span> </p> please help me i'm sorry newbie here..
  9. I created a function to count a number of appointments in my database: function bp_core_get_user_appointments( $user_id ) { global $wpdb; // Finds the total number of appointments a user has completed. if ( !$app_count_cached = wp_cache_get( '$app_count_cached_' . $user_id, 'bp') ) { $app_table = $wpdb->prefix . 'app_appointments'; $sql = $wpdb->prepare("SELECT COUNT(worker) FROM $app_table WHERE worker = $user_id AND status = 'completed' "); $app_count = $wpdb->query($sql); $app_count_cached = wp_cache_set( '$app_count_cached_' . $user_id, $app_count, 'bp', 86400); return $app_count; } else { $app_count = wp_cache_get( '$app_count_cached_' . $user_id, 'bp'); return $app_count; } } I then call this within another function thusly: $app_count = bp_core_get_user_appointments( $user_id ); if ( $app_count ) { $fullname .= ' [' . $app_count . ']'; } When I run the above SQL query in phpMyAdmin (modified slightly so it grabs the right table and everything), it produces the correct count. When it populates on my pages, however, it simply displays as: "[1]" This is regardless of how many actual appointments there are, so I'm guessing it's simply being pulled through somewhere as a boolean, i.e. "True - there are appointments here to count". But I'm not sure why. Where did I go wrong here?
  10. Thank you in advance for the support. Hopefully this will be very easy for one of you programmers out there. I recently moved our webiste to a new host provider. Everything worked well besides one page that links to phpMyAdmin. I have requested help from the hosting provider, but have turned me down (only stating it may be a version conflict within the code). I've been researching on the web, but cannot get anything I try to work. On the old server the php version was 5.3.6 . On the new one, I have the options of 5.3.20, 5.2.17, 5.3.8, 5.4.0, 5.4.8. Here is the error message I get on the page: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/peoplesf/COOP/includes/events_listing.php on line 14 Here is a portion (I think the relevant part) of the php file: require_once('../inc/db.php'); $result = mysql_query("SELECT event_date_start, event_date_end, event_title, event_description, a.assoc_name AS registration_type, b.assoc_name AS location, c.assoc_name AS speaker FROM coop_events LEFT JOIN coop_assocs a ON a.assoc_id = event_registration_id LEFT JOIN coop_assocs b ON b.assoc_id = event_location_id LEFT JOIN coop_assocs c ON c.assoc_id = event_speaker_id WHERE event_active = 1 ORDER BY event_weight ASC, event_date_start ASC "); while($row = mysql_fetch_array($result)) { <---line 14 echo '<div class="event_single">'; $date_part_1 = date("l F j", strtotime($row['event_date_start'])); if ($row['event_date_start'] == $row['event_date_end']) { // Do not display time $date_part_2 = ''; } else { // , 7-8:30pm $start_time = date("g:ia", strtotime($row['event_date_start'])); $end_time = date("g:ia", strtotime($row['event_date_end'])); if ( (stristr($start_time,'am') && stristr($end_time,'am')) || (stristr($start_time,'pm') && stristr($end_time,'pm'))) { $start_time = date("g:i", strtotime($row['event_date_start'])); }
  11. My user authentication code -- <?php $useremail = $_POST['emailfield'] ; $userpassword = $_POST['pwfield'] ; require ('sqlauth2.php') ; mysql_select_db($database, $con); $sql = "SELECT * FROM userregistry WHERE email='".$useremail."' AND password='".$userpassword."'" ; $run = mysql_query($sql) ; $row = mysql_fetch_array($run) ; if(mysql_num_rows($run) == 1) { echo "SUCCESS <br>" ; } else { echo "No login for you " ; } ?> Looks perfect, but I keep getting this error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\bullet2\logincheck.php on line 10 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\bullet2\logincheck.php on line 12 No login for you Any idea ? Searched everywhere, couldn't find anything proper. I know there is something wrong somewhere, can't seem to find it. Help me out people, thanks !!!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.