- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 4
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
WordPress Consultant & PHP Developer
- Interests
- CSS, XHTML, PHP, C++, Linux, Shell Scripting
- PC Specs
- 2.53GHz Intel Core 2 Duo, Mac OS X (10.7), 4GB RAM, 320GB HD
55 Posted Topics
I have a function that I need help with. The purpose of the function is to sort an array of objects by field. This function was using the PHP function create_function which is now deprecated in PHP 7.2. I've been trying to rewrite the function, but the results return null. … | |
Re: You should remove the echo from before your variables like echo $contractno = $_REQUEST['contractno']; Also, you want something like this: $result = mysql_query($str); while($row = mysql_fetch_array($result) { echo $row['eadd']; } The reason nothing is printing is because you are missing mysql_fetch_array and/or a while loop depending on who you want … | |
Hello, everyone. I need help with something, and I am hoping that someone could point me in the right direction. Since I am not sure what the technique is called, I will try to explain what I need to the best of my ability. I am trying to create a … | |
I am hoping that someone can point me in the right direction for this. I have a system that has default .po/.mo files located here: *./app/lang/es_ES/LC_MESSAGES/default.mo/.po*. The system has a plugin system where the plugin's .po/.mo files could be loaded here as an example: *./app/plugins/helpdesk/languages/es_ES/LC_MESSAGES/helpdesk.mo/.po*. As you can see, they … | |
I am trying to integrate elFinder and TinyMCE using the advanced method found here: https://github.com/Studio-42/elFinder/wiki/Integration-with-TinyMCE-4.x When I click the image icon in TinyMCE, elFinder will appear in a popup window, and when I double click on a file in elFinder, it should include it in the editor. However, the following … | |
As it stands, the data elements are submitted to the database. But I need help figuring out two things: one, is how to show the new deptCode in the dropdown list of deptCodes and two, how can I clear the form after a successful submit? Below is the code that … ![]() | |
I am not sure if this is possible or not, but I need help writing a query for a running balance report. I tried a few queries on my own; I've come close but not exactly what I need. For convenience, I've created an sqlfiddle: [Click Here](http://sqlfiddle.com/#!9/caa5c) The report needs … | |
I am trying to come up with a query to track a student cohort based on their start term. I want to see if the number of students that started in 2012 actually go down in 4 years time. For this example I am starting with fall 2012 (12/FA). I … | |
I was wondering if the following was possible with a query? If so, can someone give me an example query? I want to print a list of products, group them by color, and then have the totals at the end of each group. | Color | Product | ------------------- | … | |
Re: From a database design standpoint, I would say yes, this is an acceptable design for what you are wanting to accomplish. However, another option would be to include phone numbers in your contact table without the other table like so: | Contact | ============== | cid | | fname | … | |
Re: I think what you need is a group by clause after your WHERE clause: GROUP BY comment.ID | |
I am trying to do a check to see if a student meets the prerequisite before they can register for a course section. CourseSecID = 27 (ID of the course section the student wants to register for.) What I am doing is querying the student's acad cred records to see … | |
Hello, I need to run a report against a database, and I am having a difficult time thinking of a way to run a particular report. What I need to do is run a report which selects students that have no course registrations for three consecutive semesters. The semester table … | |
Re: Just in case the OP comes back to this, I created it at SQLfiddle: http://sqlfiddle.com/#!2/d6b123/2 | |
I am tring to perform a calculation in my query. I've been working on it for hours, so I need another pair of eyes to see what I am missing. Everything in the query is working except for the g.courseFee part. The course fee is not being added to the … | |
I have some code that I edited for importing csv into mysql using PDO to bind parameters. I thought it was working before, but tested it again and the issue I have is that only one line (the fourth line) of the csv file is getting imported. The first line … | |
Re: Also there is SQLEditor for Mac, however it is not free or has a community edition like Workbench. | |
I am trying to copy data from one database table to another. Below is the MySQL syntax I am working with: $array = []; $q1 = DB::inst()->select( "stu_term" ); foreach($q1 as $r1) { $array[] = $r1; } $bind = [ ":stuID" => $r1['stuID'],"termID" => $r1['termID'],":level" => $r1['level'] ]; $q3 = … | |
I have this search method that doesn't seem to work, and I am not sure why. I need an extra pair of eyes to see why my search query brings back false results. Thanks in advance. public function search($data) { $person = $data['person']; $bind = [ ":person" => "%$person%" ]; … | |
I am not a jquery guru in any sense, so I am seeking some help with the below code. What I am trying to do, is populate two input fields, based on what is selected from a dropdown field via a database call. When I select a term from the … | |
I have a query in which I insert data with json_encode(), and I am trying to receive that data with json_decode(), however, I get an error message that is something like this: stripslashes() expects parameter 1 to be string, array given in I have this database table that has about … | |
I few weeks ago, I posted some code that I need help converting to MySQLi, now I need some help converting it to PDO. The code allows you to enter queries and commands and brings back the column headings and the information that I am looking for into a table. … | |
Hello, there is a small php script that I am converting from using mysql to mysqli, but I am having a bit of an issue with mysqli_fetch_fields (this is where I assume the problem lies). Basically it is a form that allows someone to enter free form queries in order … | |
I am using a framework, and I am having an issue with getting the results of this particular associative array. All others work except for this one and I am not sure why. This one only returns one result. Here is what I have in my model: public function listStats($id) … | |
I am having a devil of a time trying to get my arrays to print right, but I am missing something. I am hoping another set of eyes can help me figure it out. I have this current function: function getArrayUsers($id) { $sql = DB::inst()->query( "SELECT * FROM " . … | |
I am getting the error message "Invalid argument supplied for foreach()". I can't see to figure out what. Below is my query. Is there something I'm missing? Thanks public function editRole($id) { $q = $this->_db->query("SELECT * FROM `" . TP . "roles` WHERE `ID` = '" . floatval($id) . "' … | |
Re: You need to include session_start(); at the top of your PHP pages. | |
I have a plugins system with update notification. The update notification works, but I made some changes so that the script will execute every hour instead of everytime the page loads. This is handled by the (time() + 3600) being written to a check.cfg file. I wanted to to cut … | |
Re: I've used something like this: [code=PHP] ini_set ('display_errors', 1); error_reporting (E_ALL & ~ E_NOTICE); ################################################################## $csv_output = "Last Name,First Name,Address 1,Address 2,City,State,Zip,Phone,Email,DOB,Member"; $csv_output .= "\n"; $result = mysql_query("SELECT * FROM members"); while($row = mysql_fetch_array($result)) { $csv_output .= "$row[last_name],$row[first_name],$row[address1],$row[address2],$row[city],$row[state],$row[zip],$row[phone],$row[email],$row[age],$row[member]\n"; } header("Content-type: application/vnd.ms-excel"); header("Content-disposition: attachment; filename=" . date("Y-m-d").".xls"); print $csv_output; exit; [/code] … | |
Ok, so I finally was able to convert my framework to the PSR-0 standards, but now I am getting errors in the sample application that I have not been getting before. I am not sure why, so I need a fresh pair of eyes. Any help is greatly appreciated. The … | |
I want to convert my MVC framework to conform to the PSR-0 standards, but I am having a devil of a time trying to wrap my head around namespaces and how it works. I am using the suggested [SplClassLoader](https://gist.github.com/221634) class. Below is my file structure, and what I am trying … | |
I am not sure if this makes sense, but in an application I've working on, there are two users. One is an admin with an admin role/capabilities and the other is a member with a member role/capabilities. Now, when I log in as the admin, there is no issue. When … | |
I need beta testers for my new project management system. It is not your typical pm, but it is a simple and lightweight system with social skills. It you are willing to download and test it out thoroughly, please visit: http://projectpress.org/messages Any help with any aspect of testing is greatly … | |
I've updated an application that I am working on to use PHPass instead of md5. I am using sessions, so when a user logs in, at some point they get reset to another user. I am not sure what is causing this issue, so some help is greatly appreciated. Below … | |
Since md5 will be deprecated at some point (if it isn't already), and will soon pass away, I thought I should think about of another way of securing passwords. I've been thinking about phpass for a while and decided to jump in feet first. I am pretty sure that I … | |
I have a singleton class that I am revamping and need a little help with. I want to use the following syntax for my queries without having to declare a global object. Below is my current code: /** * The db database object * * @access private * @var object … | |
Re: I usually set my cookies like below. Hopefully, this will help you figure out your issue. // Use to set cookie session for domain. $cookiedomain = $_SERVER['SERVER_NAME']; $cookiedomain = str_replace('www.', '', $cookiedomain); if(isset($_POST['remember_me'])){ setcookie("application_cookname", $_SESSION['username'], time()+60*60*24*365, "/", "." . $cookiedomain); setcookie("application_cookpass", md5($_SESSION['password']), time()+60*60*24*365, "/", "." . $cookiedomain); } | |
Re: You need to investigate further in these lines: $query="select count(*) from student_info where admission_no='$admission_no'"; $result=mysql_query($query); $row=mysql_fetch_array($result); if($row[0]==0) I am not sure which field is better to use count for, but you may want to change it to something like this: if($row['COUNT(admission_no)'] == 0 ) or something of that effect. | |
Re: I think a tester like simpletest would be the best tool for you: http://www.simpletest.org/ | |
Re: You may need to use domain matching to acheive your goal because I don't think it will work that way. Check out this post: http://stackoverflow.com/questions/4278564/regex-to-match-subdomains-other-than-www | |
Re: Also, that is a lot of fields to list which makes your code quite long. You might want to look into some sort of mysql class that makes this easier and/or check out something like the CRUD method: http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/ | |
Re: To help you out, here are some tables and the structure I've used: CREATE TABLE `wall_likes_username` ( `l_user` varchar(100) NOT NULL, `post_id` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `wall_posts` ( `p_id` int(11) NOT NULL AUTO_INCREMENT, `post` varchar(255) NOT NULL, `date_created` int(11) NOT NULL, `p_user` varchar(200) NOT NULL, … | |
Re: What happens if you change it to this: $stmnt1 = $dbc->prepare("INSERT INTO DEV_property_trades VALUES (?,?,?,?,?) "); if($stmnt1) { $stmnt1->bind_param("sssss",$trade_name,$trade_number,$trade_email,$trade_list,$trade_details); $stmnt1->execute(); $stmnt1->close(); //Code blocks are created by indenting at least 4 spaces } | |
Re: @clarme, I would move "2012 Emergency Network of Los Angeles" after the closing paragraph tag: </p> and then do this: <p>2012 Emergency Network of Los Angeles</p> | |
Re: At the end of line 16, you need to add ";" at the end of that line, so that it looks like this: mysql_query("DELETE FROM article WHERE a_id = '$id'"); | |
Re: I could be wrong, but I think each line should be something like below: "lastname" => ("lastname",FILTER_SANITIZE_NUMBER_INT), | |
Re: In case you don't see the difference in what @elbeato posted, there is no "value" property when using "textarea" as there is when using "input". | |
I have an options table setup like so: [CODE]option_id option_name option_value 1 sitetitle SimpleCollab 2 siteurl http://example.com/ 3 sitepath /home/user/MAMP/htdocs/pm 4 enable_registration 1 5 enable_query 1[/CODE] Then my php code is as follows: [CODE]function get_pm_option( $option ) { global $pmdb; $result = $pmdb->query( "SELECT * FROM " . DB . … ![]() | |
I have a php wizard for an application that does the MySQL insert but it comes back with an error message, and I can't seem to figure out what. Any help is greatly appreciated. Insert Statement [CODE]CREATE TABLE `{dbprefix}permissions` ( `ID` bigint(20) unsigned zerofill NOT NULL AUTO_INCREMENT, `permKey` varchar(30) NOT … | |
I've been trying for hours to retrieve an ID from a previous insert statement to include in the next insert statement. I am not sure what I am doing on but a new fresh set of eyes can see the issue better than I can at the moment. Any help … |
The End.