PHP - Wierd Blackberry Question
hello, just curious if anyone has ever used php to pull any kind of info from a blackberry?
im trying to pull something unique from a blackberry like a pin number . Similar TutorialsJust want to ask..if i use $_SERVER['REMOTE_ADDR'] to get user IP address, will it also come up with result when they use blackberry or mobile phone?? thanks two codes: does not echo the script... if($content1_1on1 || $content1_teams) { echo ''; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } does echo the script... if($content1_1on1 || $content1_teams) { echo 's'; echo "<script type='text/javascript'>$.jGrowl('<b>$header1</b> <br><br> $content1_1on1 <br> $content1_teams');</script>"; } can anyone tell me why it does not echo the script if there is nothing in the first echo?? I can't figure it out For some odd reason, when I add a snippet of PHP code to a certain page, it whitespaces the whole thing. I have other PHP snippets scattered around already. When I delete it, page is ok, with it, nothing but a grey border, all content is white. Freakin wierd. Here is the code... $day = date('d'); $month = date('m'); $year = date('Y'); $last = last_business_day($year,$month); $lastday = date('d', strtotime($last)); if($day > "15"){ $date2 = date("Y-m-" . $lastday); } else { $date2 = date("Y-m-15"); } $date1= date('Y-m-d'); $time = " 23:59:59"; $date3 = $date2 . $time; $agency = $_SESSION['AGENCY']; $agent = $_SESSION['AGENTNAME']; $query = "SELECT Amount1RS, SUM(BrokerFee), SUM(TotalCollected), SUM(Commission), AVG(BrokerFee), COUNT(ID) FROM accounting WHERE agency = '$agency' AND agent = '$agent' AND Amount1RS = 'New Business' AND Date BETWEEN '$newdate1' AND '$date3'"; $result = mysql_query($query); while($myrow = mysql_fetch_assoc($result)) {//begin of loop $totbroker = $myrow['SUM(BrokerFee)']; $avgbroker = $myrow['AVG(BrokerFee)']; $totcommission = $myrow['SUM(Commission)']; $totproduction = $myrow['SUM(Commission)'] + $myrow['SUM(BrokerFee)']; } $proquery = mysql_query("SELECT COUNT(ID) FROM clients WHERE Status = 'Prospect' AND Agency = '$agency' AND agentname = '$agent'") or die(mysql_error()); $prospects = mysql_fetch_array($proquery); $insquery = mysql_query("SELECT COUNT(ID) FROM clients WHERE Status = 'Insured' AND Agency = '$agency' AND agentname = '$agent'") or die(mysql_error()); $insureds = mysql_fetch_array($insquery); $closing = ($insureds / $prospects) * 100; $closing = floatval($closing); I even put it in teh <head> tag, same result. Anyone encountered this before? Hi Everyone I have a weird session issue going on and i'm not sure what is causing it. Basically any sessions that i set are randomly expiring sooner than they should be. As a test I did the following: Code: [Select] <?php session_start(); if(isset($_SESSION['views'])){ $_SESSION['views'] = $_SESSION['views']+ 1; }else{ $_SESSION['views'] = 1; } echo "views = ". $_SESSION['views']; echo '<p><a href="testpage.php">Refresh</a></p>'; ?> If i continue to click the refresh button, i sometimes get to 30 and then it starts at 1 again. Other times ill get to 20 and then back to 1. It has also sometimes skips a couple of counts from 7 to 11 as an example in one click. Any one come across this before? I have been reading up online and some have mentioned PHP upgrades from php4 to php5 cause some issues and specifically the hosting company changing the session.save_path. If this was the case, it wouldn't even count to 10, would it? Any help would be really appreciated. thanks in advance I keep getting the following error even though it is still inserting it it is driving me nuts any ideas?
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`campaignid`,`ipaddress`,`cc`,`country`,`oldadddate`,`oldaddtime`,`oldtimestring' at line 1
`oldrecordid`,`campaignid`,`ipaddress`,`cc`,`country`,`oldadddate`,`oldaddtime`,`oldtimestring`,`adddate`,`addtime`,`timestring` '1','1','58.9.96.60','TH','Thailand','2014-07-16','02:11:41','1405501901','2014-07-16','02:43:45','1405503825' my insert strings // INSERT IP RECORDS LOG $fi=""; $fi="`campaignid`,`ipaddress`,`cc`,`country`,`adddate`,`addtime`,`timestring`"; $fv=""; $fv="'$campaignid','$IpAddress','$cocode','$coname','$cdate','$ctime','$nowtime'"; echo "$fi<br />"; echo "$fv<br />"; $insertid="";$insertid=insertdata('iprecords',$fi,$fv,'yes');my function which has always worked until today if(!function_exists('insertdata')){ function insertdata($table,$fields,$params,$idrequired){ global $db_host; global $db_name; global $db_user; global $db_pass; $db_con=mysqli_connect($db_host,$db_user,$db_pass,$db_name); if(mysqli_connect_errno($db_con)){return false;} $insertinfo="INSERT INTO $table ($fields) VALUES ($params)"; $rinsertinfo = mysqli_query($db_con,$insertinfo); if($idrequired=="yes"){ $insertid =mysqli_insert_id($db_con); if($insertid==true) { return $insertid; } // END if($insertid==true) else { return false; } // END else } // END if($idrequired=="yes") else { return $rinsertinfo; } // END else mysqli_close($db_con); } // END function insertdata($table,$fields,$params.$idrequired) } // END if(!function_exists('insertdata')) Edited by shadiadiph, 16 July 2014 - 04:58 AM. I'm using WampServer to test php pages locally. I just started having this warning message show up: Warning: session_start() [function.session-start]: open(c:/wamp/tmp\sess_3c3f4g0dhb6qu007v167pv1u45, O_RDWR) failed: Permission denied (13) in C:\wamp\www\page_include\index.inc.php on line 2 The warning shows up and I am directed to the login page. The funny thing is, when I refresh the browser, the warning goes away and the page is directed to the page the user is directed to after they are signed in. I haven't changed any of my code since everything was working fine. Is this a problem with WampServer or possibly something that I should be looking at changing my code to fix? Any suggestions? Thanks. I got a code that figurse out if the user have watched that movie already or not now the wierd thing about it it let see if he watched buth not if he didnt watched: Code: $uid = $_COOKIE["cookname"]; $tid = $torrent["id"]; $con = mysql_connect("localhost","jornherm_acbteam","*******"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("jornherm_acbteam", $con); $query5 = "SELECT uid, tid FROM torrents_seen WHERE uid = '$uid' AND tid = '$tid'"; $gezien = mysql_query($query5); while($row = mysql_fetch_assoc($gezien)) { $uid2 = $row['uid']; $tid2 = $row['tid']; if (empty($tid2)) { echo "<img src=\"./images/notseen.png\" border=\"0\">"; } else { echo "<img src=\"./images/seen.png\" border=\"0\">"; } } DB Structu tid,uid tid=the id of the movie uid=the username Hello All,
I'm kinda new to PHP and web development and I seem to have a very wierd problem which is driving me nuts (for the last 2 days)...so I'd appreciate any and all help in getting it resolved.
Okay, so here's the problem:
In the code below, I used to have just the first statement below...which essentially accepted input as a textbox for a text field named qty_pkg (in the underlying MySQL table)...and that used to work just fine.
So then I decided to change the input type for that field to be a radio button, accepting one of two choices i.e. "UoM" or "Qty", and therefore I added the remainder of the code, whilst also commenting/remarking out the first statement.
What happens (when I added the radiobutton-related code) is that control no longer goes into the TRUE portion/logic of the "if ( !empty($_POST))" condition-check, but rather, it seems to go into the "ELSE/FALSE" portion of that conditional check. However, a record does get added to my table, even though I do not have an "INSERT INTO..." clause in the ELSE porition of that check. Also, what gets displayed on screen is as follows:
------------------------------------------------------------------------------------------------------------------------------------
Array()
There's something wrong somewhere!!!
Array()
------------------------------------------------------------------------------------------------------------------------------------
Now, if/when I comment/remark the radiobutton-related code, the "if ( !empty($_POST))" logic seems to work fine and the following is displayed on screen (which is what I expect):
------------------------------------------------------------------------------------------------------------------------------------
Array ( [datepicker] => 10/30/2014 [store_id] => 48 [new_store_name] => [item_id] => 5 [new_item_name] => [pkg_of] => 1 [price] => 1 [flyer_page] => 1 [limited_time_sale] => Array ( [0] => fri [1] => sat ) [nos_to_purchase] => 1 [create-and-add-more] => Create and Add More ) Notice: Undefined index: qty_pkg in /var/www/create.php on line 54 Array ( [0] => Array ( [item_id] => 5 [0] => 5 [item_name] => BD Cheese Strings [1] => BD Cheese Strings [section_id] => 7 [2] => 7 ) ) ------------------------------------------------------------------------------------------------------------------------------------ The other wierd thing is that if/when I now uncomment the first statement (which used to work just fine before) the "if ( !empty($_POST))" logic no longer seems to work the way it used to. Does/can someone see something wrong with my code somewhere? <!-- <?php echo standardInputField('Qty / Pkg', 'qty_pkg', $qty_pkg, $errors); ?> --> <div class="control-group"> <label class="control-label">Priced by:</label> <div class="priced-by-radio-container"> <div class="pb-radiobuttons-container"> <label class="indent-to-the-left"> <input class='priced-by-radiobutton' type='radio' name='qty_pkg' value='UoM' $pb1> <span class='no-highlight'>Unit of Measure</span> </label> <label> <input class='priced-by-radiobutton' type='radio' name='qty_pkg' value='Qty' $pb2> <span class='no-highlight'>Quantity</span> </label> </div> </div> </div> <?php echo standardInputField('UoM Name/Pkg. Of:', 'pkg_of', $pkg_of, $errors); ?> <?php echo standardInputField('Price:', 'price', $price, $errors); ?> <?php echo standardInputField('Flyer Page #:', 'flyer_page', $flyer_page, $errors); ?> print_r($_POST); if ( !empty($_POST)) { // keep track of $_POST(ed) values by storing the entered values to memory variables $store_id = $_POST['store_id']; $item_id = $_POST['item_id']; $qty_pkg = $_POST['qty_pkg']; $pkg_of = $_POST['pkg_of']; ... ... $sql = "INSERT INTO shoplist (store_id,item_id,qty_pkg,pkg_of,price,flyer_page,limited_time_sale,flyer_date_start,nos_to_purchase,section_id,shopper1_buy_flag,shopper2_buy_flag,purchased_flag,purchase_later_flag,no_flag_set) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; $q = $pdo->prepare($sql); $q->execute(array($store_id,$item_id,$qty_pkg,$pkg_of,$price,$flyer_page,$limited_time_sale,$flyerDateStart,$nos_to_purchase,$section_id,$initialize_flag_N,$initialize_flag_N,$initialize_flag_N,$initialize_flag_N,$initialize_flag_Y)); } else { echo "<br />There's something wrong somewhere!!!<br />"; print_r ($_POST); $qty_pkg = ''; $pkg_of = '';;Thanks. when in a form, I wish to build a conditional that if the response to a radio button is a value of 2 (female), it will display an input requesting for users maiden name. If not 2 goes to the next input statement. Here is code I was experimenting with: <html> <body> <form action="" name="test" method='POST'> <input type="radio" id="sex" value=1 checked><label>Male</label> <input type="radio" id="sex" value=2><label>Femaleale</label> <?php $result = "value"; if ($result == 2) echo "<input type='int' id='gradYear' size='3' required>"; else echo "Not a female!" ?> <input type="submit" value="GO"> </form> </body> </html> The code passes debug, however, Not a Female is displayed. My question is - Can I do this and if so, what value do I test against id='sex' or value. I tried each one but gave the same results. I realize that $_POST[sex] would be used after the submit button is clicked. But this has me stumped. Thanks for the assis in advance. i have took a test that i think it has some errors: can you please confirm or infirm that A is the right answer? Question: The default value for __FILE__ is _______________________________. A. the complete path of the currently executing script B. the relative path of the currently executing script C. a magical constant; it does not have a default value D. the complete path of the previous executed script E. the relative path of the previous executed script Correct Answer: C User Answer: A Explanation: The PHP engine stores the full path and filename of the currently executing script within the __FILE__ constant. Hello. I'm trying to pull information out of an xml file. However I'm a bit lost in getting the actual value. Code: [Select] $url="http://ws.audioscrobbler.com/2.0/?method=artist.getimages&artist=Dr%20Feelgood&limit=1&autocorrect=1&api_key=c107c9b5c09cb5693b6c19409dd984c1"; $xml = simpleXML_load_file($url,"SimpleXMLElement",LIBXML_NOCDATA); $largesquare=$xml->images->sizes->size[2]; Is what I have but its not pulling the information. The above url will give you the link to a set xml file for this example. And I want to get the info for the Code: [Select] <size name="largesquare" width="126" height="126">http://userserve-ak.last.fm/serve/126s/43173899.jpg</size> I'm sure I'm doing something wrong that's a simple fix but I am lost here. In the sizes there are 6 different size options each with different names and I have no idea how to pull the one with the correct name that I need. Thank you to who ever can help me sort this out. I'm creating a re classified ad site and I've hit a brick wall. I'm trying to create a 'listing' which will contain info and pictures of the property that's for sale, but I'm unsure on how to do it. Would I have to create different db tables to have the albums, images and listing together? Or would can I just do it all in one table? I appreciate your help. I'm considering getting a VPS, but I'm not entirely sure what this would be able the handle. The specs doesn't look that good to me, but my friend swears it will handle running apache/php/mysql handling large websites and databases without a problem. I want to run multiple databases that just store statistics and I'm a bit worried about the RAM and the company doesn't even mention a cpu. Here's the specs: 256MB RAM 300GB HDD 10Mbps unmetered 1 IP Address My friend runs two counter-strike: source servers off his VPS (same stats).. so I'm actually considering this, but it just seems like it's not powerful enough. Oh.. forgot the most important part.. it's only $9. Hi, I am looking into a way of adding addons to a class I made.. I thought something like this would work, but not sure how to implement it: Code: [Select] <?php class foo { function foobar($text) { $text = $text . 'b'; return $text; } } class bar extends foo { function foobar($text) { $text = $text . 'c'; return $text; } } $var = new bar(); $var->foobar('a'); // this would then return abc ?> Now i want to be able to call up foo, and it calls the foobar of foo, and the foobar of bar. is that possible? hosh Code: [Select] <?php if ($News_1_Status=="Y") echo <div class="newstitle" align="left"><?php echo $News_1_Date;?> <a href="<?php echo $News_1_URL;?>"><?php echo $News_1_Name;?></a></div><br>; else echo "Have a nice day!"; ?> how do i get the above script working any clue? hi, im trying to say if field ARTIST = Eminem then do the following. here is my current code Code: [Select] $hmm = simplexml_load_file('http://localhost/1.0/?method=player.getPlayQueue'); foreach($hmm->tracks->track as $tracks) { $artist = $tracks->artist; $title = $tracks->title; $album = $tracks->album; $index = $tracks->index; $id = $tracks->id; //If we submitted the form if('.$artist.'="eminem") { echo '<table border="0" width="70%" align="center">'; echo '<tr>'; i just need to know how to do the if(***) part. thanks. I am trying to make my database search only search where private = '$priiv'(Usually 0,1, or 2) but it does not work Code: [Select] $query_search = "SELECT * FROM users WHERE username LIKE '%$idea%' OR fname LIKE '%$idea%' OR lname LIKE '%$idea%' OR tags LIKE '%$idea%' AND private = '$priiv'"; What am i doing wrong? Hi to all people, I just want to know if there a php script I can use using DRM. The scenario, once the user download the song from a website, he/she can't forward into other using bluetooth or file transfer. It is possible to do that scenario? Thanks in advance hi php people, I am wondering will if the code below will work when I call $C->getafoo() will I get foo; I keep getting an error at this point return $this->A->a(); saying the method is not there Code: [Select] class A{ public function a(){ return "foo"; } } class B { public $A; function __construct($A) { $this->A = $A; } public function geta(){ return $this->A->a(); } } class C extends B{ public function getafoo(){ return geta(); } } $C = new C(new A()); echo $C->getafoo(); hello all, i am having a for each problem. im trying to get two post fields using the foreach function. here is what i have in my form.php: Code: [Select] <?php foreach($_POST['staff'] as $value) { echo "$value - <br />"; } ?> the name of the the fields coming in are Code: [Select] name='staff[]' and the second one is name='descr[]' fields += 1; |