Jump to content

Search the Community

Showing results for tags 'mysql'.

  • 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 (PhpStorm, VS Code, 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

  1. $id = $_POST['view']; // Pass this to see which attendee was selected in the Selection box options $stmt = $db->prepare('SELECT a.fname, a.lname, h.amount, h.subsidy, h.last_payment, h.amount_paid, h.balance FROM attendees As a INNER JOIN history AS h ON a.attendeeid = :id AND h.attendeeid = :id'); $stmt->bindValue(':id', $id, PDO::PARAM_INT); $stmt->execute(); $result = $stmt->fetchAll(); I know the last part of the query is wrong, the ON a.attendee = :id, etc. But how do I pass $id off to both a.attendeeid and h.attendeid and make it work? I need to be able to somehow make it ON a.attendeeid = h.attendeeid'); ...but that makes them devoid of $id. I've also tried $stmt = $db->prepare('SELECT a.fname, a.lname, h.amount, h.subsidy, h.last_payment, h.amount_paid, h.balance FROM attendees As a INNER JOIN history AS h WHERE a.attendeeid = :id AND h.attendeeid = :id'); $stmt->bindValue(':id', $id, PDO::PARAM_INT); but that offers nothing either. Any suggestions?
  2. If i've got a database of users that have filled out a form, can I use a cron job to send an automated email? If so, what is the best way to "loop" it so that it sends the email once to each user? $data = mysql_query(" SELECT * FROM completed WHERE followupsent='0000-00-00 00:00:00' AND valuesent + INTERVAL 4 DAY <= NOW() ") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { } This checks to see if "followupsent" has been updated already as it updates with NOW() when it sends and also checks to see how many days since the value was sent. I'm worried that by putting the email sending information in the while tags is going to loop for each row and end up sending a ton of emails. Would using if($info = mysql_fetch_array( $data )) { } Send out to the first in the database and then the CRON Job handle the rest by checking every minute which one is next? Cheers
  3. This is my code $testip = $_SERVER["HTTP_X_MXIT_USERID_R"]; if(!isset($testip)) { $testip = "Debater"; } $result = mysql_query("SELECT * FROM pm WHERE mxitid = \"$testip\" ORDER BY id DESC LIMIT $offset, $rowsperpage")or trigger_error("SQL", E_USER_ERROR); while($row = mysql_fetch_array($result) or die($result."<br/><br/>".mysql_error())) { $name = $row['username']; $mid = $row['mxitid']; $message = $row['message']; $id = $row['id']; $date = $row['time']; $myip = $row['ip']; $delete = '<a href="http://guniverse.hol.es/chat/pm.php?option=Delete&id=' . $id . '">Delete</a>'; $reply = '<a href="http://guniverse.hol.es/chat/pm.php?option=' . 'reply'. '&nname=' . $name . '&ip=' . $myip .'">Reply</a>'; echo '<b>' . $name . ':</b> <i>' . $message . ' - ' . '<span style="color:#828282">' . date( 'D H:i:s', $date ) . '</span> ' . $delete . " " . $reply .'</i><br>'; if($_GET['option']=='reply') { $mxitid = $_GET["ip"]; $result = mysql_query("SELECT * FROM Users2 WHERE mxitid='".$mxitid."'", $conn); $myrow = mysql_fetch_array($result); ?> <form name="StringyChat_form" method="POST" action="<? echo $_SERVER['REQUEST_URI']; ?>"> Type in your message...<br> <input name="message" class="StringyChatFrm" type="text" size="20" maxlength="<? echo $name_size; ?>" value="<? echo $myrow["Username"]?>"> <br> <input name="message1" class="StringyChatFrm" type="submit" value="Update"> </form> <? } if ($_POST["message1"]) { $ip = $_SERVER["HTTP_X_MXIT_USERID_R"]; if(!isset($ip)) { $ip = "Debater"; } $result = mysql_query("SELECT * FROM Users2 WHERE mxitid = \"$ip\""); $id = $_GET["id"]; $nname = $_GET["nname"]; $ip1 = $_GET["ip"]; $banby2 = $_SERVER["HTTP_X_MXIT_USERID_R"]; $row = mysql_fetch_array($result); $mxitid = $row['mxitid']; $naam = $row['Username']; $rank = $row['rank']; $date = date("U"); $mxitid = $_GET["ip"]; $message = $_POST["message"]; $query = "INSERT INTO pm (username,mxitid,message,time) VALUES (\"$naam\",\"$ip1\",\"$message\",\"$date\")"; $result = mysql_query($query, $conn) or die("Invalid query: " . mysql_error()); $query5 = "SELECT * FROM broadcast"; $result1 = mysql_query($query5) or die(mysql_error()); $users = array(); while($row = mysql_fetch_array($result1)){ if ($row['onorof'] != '') $users[] = $row['onorof']; } $batchSize = 50; // set size of your batches $batches = array_chunk($users, $batchSize); require_once ('MxitAPI.php'); /* Instantiate the Mxit API */ $key = 'a82a9fb77a9d435b8c8c066a5bbd9959'; $secret = 'c3a4f316361e4a7a8573bfe6c8652560'; $app = 'spamchat'; $nick = urldecode($_SERVER['HTTP_X_MXIT_NICK']); $admin = array('m70141099002' , 'Debater', '27765238453', ''); $moderator = array('m52626156002', 'm51256041002' , 'm50079252002', '27723289551'); $testip = $_SERVER["HTTP_X_MXIT_USERID_R"]; if (in_array($testip, $admin)){ $col = "#ff0000"; $message1 = "#ff0000" . "You Received a Mailbox message from " . $naam . " " ."\$Refresh\$"; } elseif (in_array($testip, $moderator)){ $col = "#4CA64C"; $message1 = "#4CA64C" . "You Received a Mailbox message from " . $naam . " " ."\$Refresh\$"; } else{ $col = "#000000"; $message1 = "#000000" . "You Received a Mailbox message from " . $naam . " " ."\$Refresh\$"; } if(!isset($nick)) { $nick = "Debater"; } $message = $_POST["message"]; $message1 = "$col" . "You Received a Mailbox message from " . $naam . " " ."\$Refresh\$"; $api = new MxitAPI($key, $secret); $api->get_app_token('message/send'); foreach ($batches as $batch) { $list = implode(',', $batch); // process the batch list here $api->send_message($app, $ip1, $message1, 'true'); } echo "Message has been Sent!"; } } Shows on page and after submiting the form I get the error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/u342037492/public_html/chat/pm.php on line 83 1 Line 83 is $result = mysql_query("SELECT * FROM pm WHERE mxitid = \"$testip\" ORDER BY id DESC LIMIT $offset, $rowsperpage")or trigger_error("SQL", E_USER_ERROR); while($row = mysql_fetch_array($result) or die($result."<br/><br/>".mysql_error())) { of the above code. Where am I going wrong?
  4. Hello guys, I have a question about how to insert a multiple query into database i have the following html form <div class="input_fields_wrap"> <button id="remove_field">x</button> <?php $query = mysql_query("SELECT * FROM producten"); ?> <select name="Producten[]" id="Producten"> <div><?php while($row = mysql_fetch_array($query)){ echo "<option>" . $row['Producten'] . "</option>"; }?> </div><input type="text" name="ProdOms[]"> <input type="text" size="3" name="Aantal[]"> <input type="text" size="3" name="Prijs[]"> <a href="javascript:void(0)" onclick="toggle_visibility('popup-box1');"><img src="../img/icons/info.png" height="16" width="16"></a> </select> </div> So this is the html form what I'm using i have 15 of these. It deppents how much the user would like too use for example he/she want to use 2 form like this fill it in and insert into the database.
  5. I'm currently making use of arrays to modify my font colors in my chat script for example $admin = array('m70141099002' , 'Debater', '27765238453', ''); $moderator = array('m52626156002', 'm57010835002' , 'm50079252002', '27723289551', 'm38565659002'); $testip = $_SERVER["HTTP_X_MXIT_USERID_R"]; if(!isset($name)) { $name = "Debater"; } if(!isset($testip)) { $testip = "Debater"; } ////////////////This is for Admin Permission Users////////////// if (in_array($testip, $admin)) { if (in_array($list['StringyChat_ip'], $admin)) { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . $form . ' ' . '</span>'. '<span style="color:red">' . '<b>' . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' . '<span style="color:#d8d8d8">' . " - " . $ipi . '</span>' . '<br />'; } elseif (in_array($list['StringyChat_ip'], $moderator)) { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . $form . ' ' . '<span style="color:green">' . '<b>' . $list['StringyChat_name'] . '</b>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' . '<span style="color:#d8d8d8">' . " - " . $ipi . '</span>' . '<br />'; } elseif (in_array($list['StringyChat_ip'], $pc)) { print '<span style="color:gold">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . $form . ' ' . '<span style="color:purple">' . '<b>' . $list['StringyChat_name'] . '</b>' . '</span>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' . '<span style="color:#d8d8d8">' . " - " . $ipi . '</span>' . '<br />'; } elseif (in_array($list['StringyChat_ip'], $helper)) { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . $form . ' ' . '<span style="color:blue">' . '<b>' . $list['StringyChat_name'] . '</span>' . '<span style="color:green">' . ' ' . '[H]' . '</span>' . '</b>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' . '<span style="color:#d8d8d8">' . " - " . $ipi . '</span>' . '<br />'; } elseif (in_array($list['StringyChat_ip'], $globalhelper)) { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . $form . ' ' . '<span style="color:blue">' . '<b>' . $list['StringyChat_name'] . '</span>' . '<span style="color:green">' . ' ' . '[G.H]' . '</span>' . '</b>' . ' : ' . '<span style="color:blue">' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '</span>' . '<span style="color:#d8d8d8">' . " - " . $ipi . '</span>' . '<br />'; } else { print '<span style="color:#828282">' . '(' . date( 'D H:i:s', $list['StringyChat_time'] ) . ') ' . '</span>' . $form . ' ' . '<span style="color:#0365B8">' . '<b>' . $list['StringyChat_name'] . '</b>' . '</span>' . ' : ' . filterBadWords(wordwrap($list['StringyChat_message'], $line_length,"<br>\n")) . '<span style="color:#d8d8d8">' . " - " . $ipi . '</span>' . '<br />'; } } This printout will show all the users matching the testip within the admin array, I got the same printout for moderators as well. Well the real problem I'm experiencing right now is to use my database to calculate the color it should display. I got 3 tables at this stage Table 1: Users2 Layout ID, Username, mxitid, nick, phone and rank This table is where I store the usernames of people if they register and give them the rank value of 6 Table 2: ranks_colors Layout Type, rank, color1, color2, color3, color4 Admin, 1, red, blue, orange, purple Mod, 2, green, pink, yellow, black etc... upto 6 wich is Normal This table is where I specify Type like Administrator rank 1 and 4 colors he can use within hes text printout Table 3: StringyChat Layout id, ip, name, message, time, device, rank This is basically where the messages that is being send will be stored each in its own row with the specified rank number. The problem I'm currently struggling with is the ranks I want each rank type font to be different for example in the above Table 2. If admin all the messages send by admin must be red. All the mod messages must be green etc. How can I change from the array way to mysql by using the ranks system?
  6. Hello everyone, I'm working on a project for school. It's an invoice program but I'm stuck, can anyone help me figure out how to get the values out of multiple textboxes /fields and insert them in to my database. This is what it looks like. The user can select the amount of textfields that will be inserted in to the database. <div class="input_fields_wrap"> <button id="remove_field">x</button> <?php $query = mysql_query("SELECT * FROM producten"); ?> <select name="Producten[]" id="Producten"> <div><?php while($row = mysql_fetch_array($query)){ echo "<option>" . $row['Producten'] . "</option>"; }?> </div><input type="text" name="ProdOms[]"> <input type="text" size="3" name="Aantal[]"> <input type="text" size="3" name="Prijs[]"> <a href="javascript:void(0)" onclick="toggle_visibility('popup-box1');"><img src="../img/icons/info.png" height="16" width="16"></a> </select> </div> this is my html form I have 15 of these how to insert the values in the database
  7. I am a freelance programmer from India having more than 14 years experience in web development and 8 years experience in PHP/MySQL. I am very interested in long term business relationship with web designers or internet marketeers. Please check out my portfolio at http://www.harshadnair.com/portfolio/ My hourly rates are very competitive and among the lowest you can get! If interested, mail me at harshad.nair@gmail.com or add me to Skype: harshad.nair You will always find the projects delivered by me to be of the best quality and well within time. Some samples of my work: http://www.pcmedicstores.com/pcm http://www.crazy4sportz.com http://www.royalparkwine.com http://www.angloamericandarts.com http://www.harshadnair.com/web http://www.visaworks.com http://www.h1bplanet.com http://www.financialcompound.com http://www.vliegennaar.net http://www.simlockvrijetelefoon.nl http://www.traveltravel.nl http://www.alexpadillabailbonds.com http://www.allayechan.com http://www.hotelaanbiedingen.com http://www.healthwavehgh.com http://www.andersonschoech.com/ http://www.forinjuryadvice.com/ http://dblawpractice.com http://barbaragreer.com/ http://www.weinbergerlaw.net http://www.visa4you.info http://www.gotlegalproblems.com Thanks and regards, HN
  8. Hi, I have a database that has the following layout (only relevant colums detailed index season day month year goals_scored I want to create an array with a running total of goals scored by a quarter. For example, Sum of goals scored between month=8 to month=10 month=11 to month=1 month=2 to month=4 month=5 to month=7 Where year=2002 then go through years 2002-current year what ever it is and it up. So if I have sum of month=8-10: 0 sum of month=11-1: 2 sum of month=2-4: 8 sum of month=5-7: 5 When I echo the array it will be in this format: (0,2,10,15) I also want to make a separate query for a single year, by month, i.e sum of goals scored where month=7, month=8 etc. Any indication and help explaining the function for this would help. My php is very basic, I know how create a query and make loop to echo a table of results etc. These arrays are for graphs. I want the graph to be ready for the full season even if its not happened yet.
  9. Hi I'm trying to recall a column from my table and insert it into an array. and then use the array and devide it into batches. Here is the code I got so far. $query = "SELECT * FROM broadcast"; $result1 = mysql_query($query) or die(mysql_error()); $users = array(); while($row = mysql_fetch_array($result1)){ $users[] = $row['onorof']; } $batchSize = 50; // set size of your batches $batches = array_chunk($users, $batchSize); require_once ('MxitAPI.php'); /* Instantiate the Mxit API */ $key = '50709335604c4feeaf9009b6e5f024a1'; $secret = '45a7b65b216d4f638a3cf4fc4f4e802f'; $app = 'guniverse'; $nick = urldecode($_SERVER['HTTP_X_MXIT_NICK']); if(!isset($nick)) { $nick = "Debater"; } $message = $_POST["message"]; $message1 = "*" . $nick . "*" . ": " . $message; $api = new MxitAPI($key, $secret); $api->get_app_token('message/send'); foreach ($batches as $batch) { $list = join(',', $batch); // process the batch list here $api->send_message($app, $batches, $message1, 'true'); }
  10. hello, i have this function, function withdraw() { global $db,$ir,$c,$userid; if($_POST['amount'] > $ir['bankmoney']) { echo '<span style="color:red;">You dont have enough money saved to withdraw that much!</span>'; } else { $db->query("UPDATE `users` SET `bankmoney` = `bankmoney` - ".$_POST['amount'] .", `money` = `money` + " . $_POST['amount'] . " WHERE `userid` = ".$userid); $ir['money'] += $_POST['amount']; echo 'You withdrew ' . money_formatter($_POST['amount'] + 0) . ' into your hand from your account.<br/> You know have ' . money_formatter($ir['money'] + 0) . ' in your hand.'; } } that does not seem to work correctly it will not seem to move past the first if statement even if the amount is less then the bank mone. the form which submits this is <a href="test.php?withdraw" target="_blank">>Withdraw</a><br/>'; if (isset($_GET['withdraw'])== 1){ echo' <div id="withdraw" style="background: #ffffd3;border: 1px #ffff99 solid;padding: 20px;width: 250px;margin: 5px;"> <form action="" method="post" onsubmit="makeTrans(\'withdraw\');return false;"><input type="text" name="withdraw" value="'.($ir['bankmoney']).'" /> <input type="submit" value="Withdraw" /></form> <div id="withdraw_callback"> Please select the amount you wish to withdraw then hit the withdraw button next to it. </div> </div> '; thanks
  11. So here's the situation. 1. I retrive records form mysql database. WORKS. 2. Within each record, I load a "form" via on click .button. WORKS. 3. The form is basically a way for a User to send a message to that record specifically. WORKS That process works. What doesn't work is that every time I submit a form to the database, it will not insert the "message" field text(appears empty) and the "record_id" will insert but it'll be same for all records inserted, no matter how many different records forms I submit. Other data like "message-to" and "message-by" insert fine. Here is the full page setup. Also, session_start(); is in the init.php <?php require_once 'core/init.php'; $user = new User(); $mainUserid = escape($user->data()->user_id); ?> <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <title><?php echo $title; ?></title> <meta name="description" content="<?php echo $description; ?>"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> <link rel="stylesheet" href="css/style.css" media="screen"> </head> <body> $getRecord = $db->prepare("SELECT records.*, users.* FROM records LEFT JOIN users ON records.user_id = users.user_id ORDER BY record_id DESC LIMIT 10"); $getRecord->execute(); $resultRecord = $getRecord->fetchAll(PDO::FETCH_ASSOC); if(count($resultRecord) < 1) { $error = '0 records found.'; } else { foreach($resultRecord as $row) { $record_id = escape(intval($row['record_id'])); $user_id = escape(intval($row['user_id'])); $username = escape($row['full_name']); $title = escape($row['title']); $details = escape($row['details']); $_SESSION['record-id'] = $record_id; $_SESSION['message-to'] = $user_id; $_SESSION['message-by'] = $mainUserid; $message = Input::get('message'); // HTTP method POST or GET $_SESSION['message'] = $message; ?> <div class="record"> <h1><?php echo $title; ?></h1> <p><?php echo $details; ?></p> <p><?php echo $user_id; ?></p> <button class="button">send message</button> <!-- this form loads through on click(.button) function and is located in "ajax/form.php" --> <form class="new-form"> <textarea name="message" class="message">Enter message</textarea> <input type="button" name="submit" class="form-submit" value="Send Message"> </form> </div> <?php } } <!-- js scripts below --> <script src="js/jquery-1.11.0.min.js"></script> <script> $(document).ready(function(){ $(".button").click(function(){ $(this).parent().load("ajax/form.php"); }); }); </script> <script> $(document).on('click','.form-submit',function() { if($(".message").val()==='') { alert("Please write a message."); return false; } $(".form-submit").hide(); //hide submit button var myData = 'message='+ $(".message").val(); //build a post data structure jQuery.ajax({ type: "POST", // HTTP method POST or GET url: "process.php", //Where to make Ajax calls dataType:"text", // Data type, HTML, json etc. data:myData, //Form variables success:function(response){ $(".message").val(''); //empty text field on successful $(".form-submit").show(); //show submit button }, error:function (xhr, ajaxOptions, thrownError){ $(".form-submit").show(); //show submit button alert(thrownError); } }); }); </script> </body> </html> here is process.php <?php require_once 'core/init.php'; $session_record_id = $_SESSION['record-id']; $session_message_to = $_SESSION['message-to']; $session_message_by = $_SESSION['message-by']; $session_message = $_SESSION['message']; $insertMssg = $db->prepare("INSERT INTO sub_records(record_id, message_to, message_by, message, bid_posted) VALUES(:record_id, :message_to, :message_by, :message)"); $insertMssg->bindParam(':record_id', $session_record_id); $insertMssg->bindParam(':message_to', $session_message_to); $insertMssg->bindParam(':message_by', $session_message_by); $insertMssg->bindParam(':message', $session_message); $resultInsert = $insertMssg->execute(); if($resultInsert == false) { $error = 'Your message could not be inserted.'; } else { $success = 'Your message has been added.'; } ?> <div class="success"><?php echo $success; ?></div> <div class="error"><?php echo $error; ?></div>
  12. For eg, say I am retreiving 3 records from database and they look like this. <div class="record"> <h1>Record title 1</h1> <p>Record description</p> <button class="button">send message</button> </div> <div class="record"> <h1>Record title 2</h1> <p>Record description</p> <button class="button">send message</button> </div> <div class="record"> <h1>Record title 3</h1> <p>Record description</p> <button class="button">send message</button> </div> and this is my ajax to load the form. <script> $(document).ready(function(){ $(".button").click(function(){ $(".record").load("form.php .new-form"); }); }); </script> the form looks like this. <form class="new-form"> <textarea name="message" class="message"></textarea> <input type="button" name="submit" class="form-submit" value="Send Message"> </form> That all works. The only problem with that is, it loads the form in EACH record. How can I make it so that the form only loads to the div record from which I am calling from?
  13. I'm writing a small applications with episodes which contain 10-15 screenshots with each screenshot having 5 different resolutions. Every week there are about 20 new episodes. You can imagine that every week I have a lot of screenshots which have to be somehow linked to their respective episode. Currently the filenames are stored in a MySQL database, but after 5 minutes of testing I already have 100+ rows. Not quite sure if that's a smart way of moving forward. The advantage of having them in the DB is that I can easily grab them using Eloquent ORM without having to finnick around with regeneration of filenames for on the fly loading. Are there any good other alternatives of linking multiple files to database entries? Or should I just stick with the current method? What would be some adverse effects of doing it this way?
  14. Need little help with the quiz problem. I want to set time limit for each question in quiz module (say 30 seconds) and after that time, the form will auto submit the question (auto submit = no option selected = unanswered). There are 3 questions, so total time limit is 90 sec (30 sec each). I'm doing this via XAMPP. The link below provide the work so far https://www.dropbox.com/s/4dzlgjtjzvs48vw/quiz.rar?dl=0 Thanks
  15. GoodWorld is an early-stage, venture-funded start-up changing the face of philanthropy through an innovative approach to online fundraising. Our technology allows you to donate without leaving social media, simply by writing #donate on any Facebook post or when you tweet at any of our partner charities. Job Description GoodWorld seeks an experienced PHP developer with a passion for elegant/functional code as well as doing good in the world. The ideal candidate will have experience leading a development team and with agile development methods. Responsibilities: - Determine operational feasibility by evaluating analysis, problem definition, requirements, solution development, and proposed solutions. - Document and demonstrates solutions by developing documentation, flowcharts, layouts, diagrams, charts, code comments and clear code. - Prepare and install solutions by determining and designing system specifications, standards, and programming. - Improve operations by conducting systems analysis - Obtain and license software by obtaining required information from vendors; recommending purchases; testing and approving products. - Collecting, analyzing, and summarizing development and service issues. - Develop software solutions by studying information needs, conferring with users, studying systems flow, data usage, work processes, and investigating problem areas Skills & Requirements Experience: - PHP - MySQL - PHPUnit or other testing framework - Ubuntu server administration - Twitter API and Facebook API integration Bonus, experience with: - Amazon Web Services - Continuous deployment - Laravel framework - Payment gateway integrations Location: Onsite strongly preferred, but open to remote employment Salary: $60-120K; a small equity allotment also possible If interested, email me at rasheen@nsphire.com
  16. I have a register form where a user enters a full name, email and password. I do not want to give them the option of choosing their own "username"; rather I want to automatically create the username from their "full name". So far I can create the username by removing space and symbols from full name. Like this. $fullname = trim($_GET['fullname']); $username = preg_replace('/\s+/', '', $fullname); Looking at that, John Smith would become "johnsmith". Since there could be dozens of people with the name "john smith", I was thinking of assigning unique number to each of them. Like this "johnsmith1", "johnsmith2", "johnsmith3"..etc. How would you say I go on incrementing the username like that?
  17. So, I currently have a script (in beta mode, only works when the sun shines), that can upload an image and store directly in a mysql database (using the BLOB data type); the script is also able to retrieve the BLOB data and display them vertically on the page; I actually need to dsiplay them horizontally across the page instead. So currently the retrieved images are printed in this format: 1 2 3 4 5 6 7 8 and I need it to print this way: 1 2 3 4 5 6 7 8 sounds like a for loop somewhere... any takers on how to implement the feature?
  18. Hi, I have a table with the following data: id name hours annual_leave ================================= 1 Chris 10 0 2 Tony 15 0 3 Mark 9 0 4 John 23 0 5 Lee 8 0 What i want to achieve is: If an employee worked 10 hours or more then reward him/her with 1 day annual leave. By default the value of annual_leave is "0". So i find all eligible employees and store their IDs in a table: $eligible = array ( 0 => 1, 1=>2 , 2=>4); id name hours annual_leave ================================= 1 Chris 10 1 2 Tony 15 1 3 Mark 9 0 4 John 23 1 5 Lee 8 0 What i want to do is to create a single UPDATE query that will find all 3 employees and change the annual_leave value from 0 to 1. I can do this easily within the loop i use to create the $eligible table.. But i have the following questions: a) can i use a single UPDATE query to update multiple rows/columns in a table? b) what is better? a single query to update multiple rows/columns or multiple queries that update a single row/column per time c) can i combine PHP and MYSQL to syntax a query? because in case the $eligible array carries 1000 entries i will need to iterate through it using a FOR or WHILE loop.. Any other comments will be appreciated..
  19. I didn't found any nice materials comparing the two ways of information unload to user. Neither have I a firm understanding of how high my learning curve should be in both cases, which of which to choose for better way. I'm a beginner asking for your professional word of advice. Help me to better formulate for search what I want, Please. I know keeping files and images in fs is better served by os/fs-drivers but i'm just learning and just trying to remember select * for "poking around". + i do hate images text analyzing it'll will be! Is it better to save files from MySQL fields via http headers, or it's even more better to perform the saving of the kept txt files (in one specific folder) and all the maintenance of tempfiles on server (archiving, indexing, cron/planning)? So: 1. Learning & get experience in file maintenance? vs 2. Finding out how to deal with protocols (download resuming) What I've found so far: header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment'); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Length:'); There's a textfield full of appended edits of a specific user (for example list-ordering/or article appending). Headers should deliver it as a file, while skiping the file creation on a server. Or do I just learn how to do it with files and save just file link then accomplish the persistent file-links cleaning (because there would be lots of them)? One one side there is a certain straightforwardness in dealing with files, but then again I'd prefer the both ways while considering continuing to study MySQL-approach. I understand protocols/headers with PHP are no easy task that's why I'm hopefully leaving the last word for the professional.... Thanks in advance!
  20. Please Help me to solve my problem.. I'm having some difficulties in solving the issue please HELP me I have this code <div class="span5"> <?php $get_id = $_GET['org_id']; $oid = isset($_GET['org_id'])?$_GET['org_id']:""; $query_vote=mysql_query("select * from votes where position='President' and voters_id='$session_id'"); $count=mysql_num_rows($query_vote); $row=mysql_fetch_array($query_vote); $id=$row['vote_id']; if ($count==1){ ?> <script type="text/javascript"> jQuery(document).ready(function() { $('#delete<?php echo $id; ?>').tooltip('show'); $('#delete<?php echo $id; ?>').tooltip('hide'); }) </script> <h6>My Candidate for President</h6> <div class="none"><img class="img-polaroid" src="admin/<?php echo $row['img']; ?>" width="88" height="88"/> <a><?php echo $row['firstname']." ".$row['lastname']; ?></a> <a class="btn btn-danger" data-placement="right" id="delete<?php echo $id; ?>" title="Click to Remove" href="#<?php echo $id; ?>" data-toggle="modal"> <i class="icon-remove icon-large"> </i></a> <!---delete modal --> <?php include('delete_user_modal.php'); ?> <!---delete modal --> <?php }else{ ?> <h6>Candidate for President</h6> <?php $result = mysql_query("SELECT candidates.candidates_id, candidates.firstname, candidates.lastname, candidates.img FROM candidates INNER JOIN voters ON voters.org_id = candidates.org_id WHERE position='President' AND candidates_id='$get_id' "); while($row=mysql_fetch_assoc($result)) { $id=$row['candidates_id']; ?> <script type="text/javascript"> jQuery(document).ready(function() { $('#a<?php echo $id; ?>').tooltip('show'); $('#a<?php echo $id; ?>').tooltip('hide'); }) </script> <div class="picture"><img data-placement="bottom" id="a<?php echo $id; ?>" title="Drag the Image to the ballot Box to Vote for <?php echo $row['firstname']." ".$row['lastname']; ?>" class="img-polaroid" src="admin/<?php echo $row['img']; ?>" width="88" height="128"/> <br> <a><?php echo $row['firstname']." ".$row['lastname']; ?></a> </div> <?php } ?> <?php } ?> <div> But the problem is that im getting this error in my page Notice: Undefined index: org_id please help me and give me some advice on how to resolve this
  21. Hello all, I am trying to setup parameterised queries to prevent sql injection from a html from when adding data to my database. I have been doing some reading on W3schools website about it. the code i have been looking at i tried to combine with my request to insert but with no joy. here is the code i was looking at $stmt = $dbh->prepare("INSERT INTO Customers (CustomerName,Address,City) VALUES (:nam, :add, :cit)"); $stmt->bindParam(':nam', $txtNam); $stmt->bindParam(':add', $txtAdd); $stmt->bindParam(':cit', $txtCit); $stmt->execute(); and here is the code i have created from the code i was looking above <?php $name = $_POST['name']; $desc = $_POST['description']; $price = $_POST['price']; $image = $_POST['image']; $prod_type = $_POST['prod_type']; $made = $_POST['made']; $dist = $_POST['distribute']; $servername = "mysql5.000webhost.com"; $db = "a6382499_product"; $user_name = "a6382499_sonic"; $password = "phpfreaks1"; global $conn; // create connection to db try { $conn = new PDO("mysql:host=$servername;$db", $user_name, $password); // PDO error mode set to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected to database"; } // Set veriable to catch error created catch(PDOException $error) { echo "Connection failed: " . $error->getMessage(); } try{ $stmt = $db->prepare("INSERT INTO Products(NAME, DESCRIPTION, PRICE, IMAGE, TYPE, MADE, DISTRIBUTE) VALUES (:name, :desc, :price, :image, :prod_type, :made, :dist)"); $stmt->bindParam(':name', $name); $stmt->bindParam(':desc', $desc); $stmt->bindParam(':price', $price); $stmt->bindParam(':image', $image); $stmt->bindParam(':prod_type', $prod_type); $stmt->bindParam(':made', $made); $stmt->bindParam(':dist', $dist); $stmt->exec(); $conn->exec($sql); echo "New record added"; } catch(PDOException $error) { echo $sql . "<br />" . $error->getMessage(); } ?> the error message i am getting is and line 32 in the code is $stmt = $db->prepare("INSERT INTO Products(NAME, DESCRIPTION, PRICE, IMAGE, TYPE, MADE, DISTRIBUTE) any help would be much appreciated.
  22. Good Day, Please help me to create a simple organisation management in php so this is the scenario, i have 3 tables (organisation, student, teacher) the simple system works fine But the problem is that adding organisation to my system. ? because before i just type it in my query WHERE org_name = 'COMTECH' to my students query and to my index query after i log in as a student how can i add organisation and create a log in that connects the student on the organisation that he is registered ? So this the example data in my database table Organisation.tbl org_id: 1 org_name: COMTECH org_description: computer fundamentals Student.tbl Teacher.tbl student_id: 1 teacher_id: 1 username: student username: teacher password: demo password: demo firstname: alvin user_type: Admin lastname: biares So right no im having hard time to solve the problem that if the organisation was created and the students are registered to that organisation the student can see only the teachers who are already registered in that organisation. ? please help me..
  23. Hi, I have a PHP script sendEmail.php that given some data (receiver, content, etc), sends an email to the receiver. When i click the Send button i fire the sendEmail.php script using AJAX: $('#sendbutton').on('click', function(){ $.ajax({ type: "POST", url: "js/ajax/sendEmail.php", data: {receiver:receiver, content: content} }); }); I want to add a feature call "Schedule send" where the user can select in how many minutes the email will be send. What i did, was to take the minutes value, insert it into a countDown timer, and as soon as the time is Zero, to fire the same AJAX call. This is working only if the browser is open. And i can understand this, since it is Javascript's responsibility to fire the AJAX call since its the one on client site. QUESTION: Is there a way to fire this sendEmail.php scipt even if the web browser is closed?Using PHP/MYSQL of course.. For example the user will select the recipient, write the email, schedule it to be sent 20 minutes later, and close the browser. If not, what are your suggestions? Thanks in advance, Christos
  24. So this is the scenario, i have 3 tables in my database voters.tbl, candidates.tbl, organisation.tbl so if the voters registered by the organisation and the candidates registered in the same organisation like the voters. The user/Voters must see only the candidates that has the same id of a voter. Let's say ORGANISATION.TBL ---------------------- CANDIDATES.TBL org_id: 1 ------------------- org_name: umbrella candidates_id: 1 firstname: ramon lastname: mclights org_id: 1 VOTERS.TBL ------------------ voters_id: 1 firsname: Anne lastname: Sunga org_id: 1 The bold text are the value of the column Please help me here how can i Query and compares the id of candidates and voters
  25. Hello, I've been working on rather simple comment system and when I try and grab all the comments that are "connected" to a post, I receive the Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000] error. The full error: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 '-5, 5' at line 1' in C:\xampp\htdocs\post\index.php:90 Stack trace: #0 C:\xampp\htdocs\post\index.php(90): PDO->query('SELECT * FROM c...') #1 {main} thrown inC:\xampp\htdocs\post\index.php on line 90 My code: $start = 0; $limit = 10; if(isset($_GET['p'])) { $id = $_GET['p']; } else { redirect("/"); } $start = ($id - 1) * $limit; $query = $database->query("SELECT * FROM comments WHERE post_id = '$id' ORDER BY date DESC LIMIT $start, $limit"); while($row = $query->fetch()) { $author = $row['author']; echo $author; } I honestly don't understand why this isn't working. I've used the exact same syntax for my post section on my website. If anything else is needed, just let me know. Thanks for the help!
×
×
  • 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.