Hi All
I am attempting to connect to a remote MySQL server from my local machine virtualhost using the following code:
$conn = mysql_connect("$dbhost", "$dbuser", "$dbpass") or die(mysql_error());
mysql_select_db($dbname, $conn) or die(mysql_error());
My problem is that I am unable to connect locally, receiving the error:
...
I'd like to add a like/dislike-upvote/downovote-type feature to each one of the posts in the forum script I'm writing (much like the one here in SO). I'm having two difficulties trying to figure out how it can be done:
1) I can't figure out a db schema that'd do it efficiently. I could use a separate \likeordislike\ table to make a rela...
Why does mysql_num_rows($result) return 1 even if $result returns empty result set?
$resut=mysql_query("select * from tablename where column1='$memberid' and (TIME_TO_SEC(TIMEDIFF(NOW(),when_submit))/60<2)")or die(mysql_error());
$count=mysql_num_rows($result);
when I echo $count, I get
1
.
...
I have asked several questions about Zend and its search functions.
Now after further reading I have noticed that it requires FULL-TEXT indexes in the MySQL fields.
My webhosting provider doesn't allow me to change anything in the my.ini (my.cnf) file, which holds information about minimum length of word to search full-text indexes an...
I write a lot of queries resembling the query example code below. I was wondering whether there was a more efficient code/script?
$query1 ="SELECT * FROM table1 WHERE date >= '$todaysdate' ";
$result1 = mysql_query($query1)
or die ("Error in query: $query1. " . mysql_error());
if (mysql_num_rows($result1) > 0) {
while($row1 = m...
We have tables with more then 3m records. When using innerjoin it is much slower then select * from db1,db2 where db1.field=db2.field
Any thoughts?
...
Hello everyone,
I am a developer previously working on SQL Server and Windows platform. I am learning MySQL on Windows platform. I have two basic questions which does not find definite answer yet,
Does MySQL support T-SQL to write store procedure? If not, are there similar technologies to T-SQL in MySQL world (I am referring to stable...
Hello everyone,
I am a developer previously working on SQL Server and Windows platform. I am learning MySQL on Windows platform to feel the power of free and open software, and also spirit of it. :-)
My requirements to learn,
I am working on .Net (C#) and native (C++) programming language on Windows platform, I want gurus here recomm...
I am using mySQL 5.1 and am wondering, is it necessary to add CREATE INDEX syntax on a column after you have defined it in a FK relationship. Common sense tells me that if a column is a key (foreign or otherwise), then it needs to be indexed - but you never know ...
Do I have to EXPLICITLY create an index on my FK - or does creating an ...
To keep this simple, let's say I'm making a basic pageview counter in php that stores the counts for each page in a mysql table. The table had 2 colums: PAGE_ID and COUNT.
I added the following code to every page:
$query = "INSERT INTO table VALUES ('$page_id', '1')
ON duplicate KEY UPDATE COUNT=COUNT+1";
$result = mysqli_que...
I am writing a data warehouse, using MySQL as the back-end. I need to partition a table based on two integer IDs and a name string.
A more concrete example would be to assume that I am storing data about a school. I want to partition the school_data table based on COMPOSITE 'Key' based on the following:
school id (integer)
course_id (i...
hello all
I want to create an application for my friends ,Its like a slam book
I want like this
in nameditbox when i entered name it has to fetch data from database and have to display in respected fields
example : nick name editboz :nick
number:1111
2.moreover i want to add to database new entry from my application b...
I am trying to optimize my mysql table a little bit in order to have a slightly more manageable table. I would like to store user permissions in a bit field.
For example, a users permissions could be 0110 (I have a growing number of user permissions, so the length of this could be a bit longer)
The example might correspond to the follo...
I am coordinating a number of PHP development projects. I have setup a workflow where developers all work with one Subversion repository. When they are ready to take a look at their application on staging servers upload a MySQL DB dump and create a tag.
I have configured a shell script that will automatically deploy the PHP code to th...
Hello,
I have developed a script but whenever i open admin panel it shows just a blank page, however the same script works fine on my another server. I tried changing chmod of files and folders 644, 755, 775 and 777 but still it outputs a blank page.
The main script works fine but its only admin panel thats not working. I check .htacce...
I have a (Wordpress) blog and some of my older posts have a character encoding problem where £ displays as £ (i.e. a pound sign prepended with a capital 'A' with a hat on).
The problem is at the DB level, so I was going to run the following SQL statement:
update wp_posts set post_content = replace(post_content, ‘£’, ‘£’);
Would thi...
I have unpredictable frequency of Incoming csv data file which I need to store into mysql database. I can get multiple csv file in a day or I can get one csv file in one week.
CSV files contains data that is valid for the day when it was received meaning it contains offers details which are valid for only the day file was send and so my...
I'm building a private messaging system for a dating site..having troubles with a group by query. Here is the structure of the table:
`id` bigint (20) NOT NULL AUTO_INCREMENT ,
`fromme` integer (11) NOT NULL,
`tome` integer (11) NOT NULL,
`subject` varchar (255) NOT NULL,
`message` longtext NOT NULL,
`mydate` datetime NOT NULL,
`t...
I have a table that looks like this:
(so you can picture it visually)
13 22 12
10 8 12
html:
<table>
<tr>
<td>13</td>
<td>22</td>
<td>12</td>
<tr>
<td>10</td>
<td>8</td>
<td>12</td>
</tr>
</table>
it's being populated by mysql rows:
<?php
$i = 1;
$id = mysql_fetch_assoc(mysql...
Hi all,
Im trying to figure out how to handle this is no results are returned, how would I code that?
while($row = mysql_fetch_array($Result))
So like if there a results: print them out
else: show a link
...