PHP - How To Convert Table From Innodb To Myisam
I use PHPMyAdmin. I have to convert an InnoDB table to a MyISAM table. I then have to add a FULLTEXT index to two of the table's columns.
Is this how I should proceed?
1) Backup table by exporting its contents.
2) Go to "Relation view" and drop foreign key constraints.
3) ALTER TABLE `table_name` ENGINE = MyISAM;
4) ALTER TABLE `table_name` ADD FULLTEXT index_name (col1,col2);
Is that it? Is it safe?
Note that the table contains approximately 3,500 rows.
Similar TutorialsHi Masters,
I'll be making a big ticketing program with PHP and I cant decide what data type to use.
Thanks,
Marvin
I present videos on my site. The videos (their titles, descriptions, etc.) are stored in a MySQL database. I want visitors to be able to search my database for videos. My MySQL version is 5.5.40-36.1. The storage engine of my tables is INNODB. The two columns I want searched a title (varchar; unique index) description (text; no index) According to my research, the best way to allow users to search my database would be to use FULLTEXT, but my INNODB tables are incompatible. FULLTEXT is available for INNODB in MySQL 5.6.4 and above. I would rather not use LIKE '%...%', and I would rather not use a third party solution such as Sphinx because my database will never grow particularly large (I doubt it'll ever exceed 6,000–8,000 videos). What do you guys recommend? Is it okay to use LIKE with a database containing 6,000–8,000 items? Hi I have members DOB stored in a mysql table field called birthday in the following format YYYY-MM-DD I can't seem to convert the time stamp into the members age I need to be able to feed $birthday which is the field in mysql table that is in the above format and then use php code to convert to members age Everything I try doesn't seem to work I have a file that is uploaded by the user that has a series of rows of data in an html table. The columns are always a constant, but the number of rows in the file can change. These rows of the html table are the only information in the file when I am processing it. I need to either convert the file to a CSV file or write the values to a CSV list so that I can then insert them into a database. Any suggestions would be wonderful...I've spent the last three hours spinning my wheels. Here is an example of one row of data from the file: Code: [Select] <tr><td bgcolor=#dddddd class=dataFT >5 (Excellent)</td><td bgcolor=#dddddd class=dataFT >5 (Excellent)</td><td bgcolor=#dddddd class=dataFT >5 (Excellent)</td><td bgcolor=#dddddd class=dataFT > </td><td bgcolor=#dddddd class=dataFT > </td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >1015020</td><td bgcolor=#dddddd class=dataFT >155498322</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >4731751</td><td bgcolor=#dddddd class=dataFT >2011-09-25 11:18:33 (-5:00)</td><td bgcolor=#dddddd class=dataFT >2011-09-25 12:16:50 (-5:00)</td><td bgcolor=#dddddd class=dataFT >0:58:17</td><td bgcolor=#dddddd class=dataFT >0:58:16</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >DATA</td><td bgcolor=#dddddd class=dataFT >Resolved</td></tr> Hi all!!! I could really use some help. I'm burning my brain out trying to figure out the easiest way to go about this. Here is what I am trying to do (in a nutshell) so I could really use full coding examples. I need to create a text area with simple formatting tools such as Bold, Italics, Underline, Bullets, and Numbering. After formatting the text with only those available formatting tools, everything in the text area needs to be converted into html tags. After the conversion, the HTML data that is create is submitted into a single field into a SQL database. Any help will be greatly appreciated!!! Hi, I have a connection set up to an API using a PHP script - the API sends back data in JSON format, and if I capture it and echo it, it displays in extremely unfriendly format on the screen. I've tried to find a way to convert this data into readable format, ideally in a HTML table, but although there are articles on converting manually inputted JSON data into a HTML table using Javascript, I can't find a way to do it from a PHP variable. This is what I have so far: if ($_POST['getcompany']) { $companyname = $_POST['_Name']; $ch = curl_init(); $data_array2 = array( 'token' => $token ); $make_call2 = json_encode($data_array2); //echo 'Token is '.$token; $token2 = substr($token, 14); $token3 = substr($token2, 0, -3); //echo 'Token 2 is '.$token3; //echo 'Company Name is '.$companyname; //curl_setopt($ch, CURLOPT_GET, 1); //curl_setopt($ch, CURLOPT_POSTFIELDS, $make_call2); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Authorization: '.$token3.'')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'https://connectionurl?countries=GB&name='.$companyname); //Execute the request $result = curl_exec($ch); echo 'Companies: '.$result; //This displays the data provided by the search, but is in JSON format
So I need a way to get the data held in $result, into a HTML table. Any idea how I can do this? This is my first real jump into PHP, I created a small script a few years ago but have not touched it since (or any other programming for that matter), so I'm not sure how to start this. I need a script that I can run once a day through cron and take the date from one table/filed and insert it into a different table/field, converting the human readable date to a Unix date. Table Name: Ads Field: endtime_value (human readable date) to Table Name: Node Field: auto_expire (Converted to Unix time) Both use a field named "nid" as the key field, so the fields should match each nid field from one table to the next. Following a tutorial I have been able to insert into a field certain data, but I don't know how to do it so the nid's match and how to convert the human readable date to Unix time. Thanks in advance!. create table mimi (mimiId int(11) not null, mimiBody varchar(255) ); <?php //connecting to database include_once ('conn.php'); $sql ="SELECT mimiId, mimiBody FROM mimi"; $result = mysqli_query($conn, $sql ); $mimi = mysqli_fetch_assoc($result); $mimiId ='<span>No: '.$mimi['mimiId'].'</span>'; $mimiBody ='<p class="leading text-justify">'.$mimi['mimiBody'].'</p>'; ?> //what is next? i want to download pdf or text document after clicking button or link how to do that How can I echo this as seconds? $date_at_timezone = new DateTimeZone('Asia/Shanghai'); $date = new DateTime(); $date->setTimezone($date_at_timezone); echo $date->format('l dS F Y h:i:s A') . "Asia/Shanghai<br>"; I have the following code in javascript, I would like to rewrite it in PHP, if someone can help thank you very much. my code: http://pastebin.com/Jnt8RiYj I have come across a little feature I need to create to be able to upload .doc files and convert them to .pdf using PHP. I was wondering if anyone had any idea how I would go about achieving this, I am not asking for the code, I'm just asking on how it could be accomplished...I've searched Google and other PHP related forums but none have the answer to which I am looking for. Any ideas or suggestions are greatly appreciated. Regards, PaulRyan. Hi Coders,
any body can convert the following code into codeigniter.
if($_GET['type'] == 'country'){ $result = mysql_query("SELECT name FROM country where name LIKE '".strtoupper($_GET['name_startsWith'])."%'"); $data = array(); while ($row = mysql_fetch_array($result)) { array_push($data, $row['name']); } echo json_encode($data); }Thanks Olá,
I have this codE:
$cb = 'str_replace("' . $this->LE . '", "", "<$1>");'; $encoded_value[$key] = preg_replace("/<([^>]+)>/e", $cb, $encoded_value[$key]);error: "PHP message: PHP Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead How can i transform this code to preg_replace_callback ? thanks Anyone know how to convert this to php? function IntNoise(32-bit integer: x) x = (x<<13) ^ x; return ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end IntNoise function I tried, and passing numbers to it isn't working, I am always getting 1 for a result, I should be getting anything between -1 and 1 My attempt: function random($x){ $x = pow($x<<13, $x); return ( 1.0 - ( ($x * ($x * $x * 15731 + 789221) + 1376312589) & 0xFFFFFF) / 1073741824.0); } Hello I'm building a backend to allow a client to upload images to his site. But my client has a lot of images in tiff format so i'd like to be able to convert tiff to jpg and only after that upload the image. i'm using the command move_uploaded_file to upload the original image and then i'm resizing the image and creating a new one and delete the original. now i want to add to my script a way to convert the original tiff to jpeg, resize save and delete the original here is my code that it's working fine: Code: [Select] if ($_FILES['foto']['name'] == "") { $dir = "images/spacer.gif"; } else { $size = 124; // the thumbnail height $filedir = 'img/ambientes/'; // the directory for the original image $thumbdir = 'img/ambientes/'; // the directory for the thumbnail image $prefix = 'small_'; // the prefix to be added to the original name $maxfile = '200000'; $mode = '0666'; $userfile_name = $_FILES['foto']['name']; $userfile_tmp = $_FILES['foto']['tmp_name']; $userfile_size = $_FILES['foto']['size']; $userfile_type = $_FILES['foto']['type']; if (isset($_FILES['foto']['name'])) { $prod_img = $filedir.$userfile_name; $prod_img_thumb = $thumbdir.$prefix.$userfile_name; move_uploaded_file($userfile_tmp, $prod_img); chmod ($prod_img, octdec($mode)); $sizes = getimagesize($prod_img); $aspect_ratio = $sizes[0]/$sizes[1]; if ($sizes[0] <= $size) { $new_width = $size; $new_height = abs($new_width*$aspect_ratio); }else{ $new_width = $size; $new_height = abs($new_width/$aspect_ratio); } $destimg=ImageCreateTrueColor($new_width,$new_height) or die('Problem In Creating image'); $srcimg=ImageCreateFromJPEG($prod_img) or die('Problem In opening Source Image'); ImageCopyResampled($destimg, $srcimg, 0, 0, 0, 0, $new_width, $new_height, $sizes[0], $sizes[1]) or die('Problem In resampling'); ImageJPEG($destimg,$prod_img_thumb,90) or die('Problem In saving'); $uploadfile = $prod_img_thumb; imagedestroy($destimg); $fh = fopen($prod_img, 'w') or die("can't open file"); fclose($fh); unlink($prod_img); $dir = $uploadfile; } } anyone can help me? I have some words are written by UTF-8. I want to use PHP to convert them to NCR DECIMAL. This is my words. After Convert: Sorry my bad English. Thanks advance This is TEXT FILE my Source. (attach File) [attachment deleted by admin] Hey guys I'm having a bit of a problem trying to convert this string to UTF-8 encoding Quote 組ですが、 中には5- 6本のおす すめ番組の エッセンス が、ぎっし り詰まって います。 I've used $strTem = mb_convert_encoding($strTem, "UTF-8", "auto"); and while that detects the correct current encoding it doesnt change it at all and utf8_encode doesnt work at all, dont know what to use. Thanks I have a new project coming up, and one of the functions that this person wants is to convert word documents/pdf/html etc. to the ePub format. I've googled, but i haven't been able to find any code references for getting this accomplished...has anyone had any experience with this? Any suggestions? Any help would be appreciated! Also, I wouldn't mind an API if there even is one... Hi, This is my first post here, i hope you guys can help me out. I'm using a flashupload to upload multiple files at once but this upload returns an error when there an image in CMYK is beeing uploaded. Now i was wondering if there was a PHP script that converts a CMYK image to a RGB image. Thanks in advance! |